<FromGitter>
<bew> @Val crun looks nice! It looks almost exactly like what I wanted to do ^^ great job
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
<FromGitter>
<asterite> 7
<crystal-gh>
[crystal] miketheman opened pull request #6467: Validate Crypto::Bcrypt::Password is a valid hash (master...miketheman/5357) https://git.io/fN2lG
Ven`` has quit [Ping timeout: 256 seconds]
Ven`` has joined #crystal-lang
oprypin has quit [Ping timeout: 264 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
FromGitter has quit [Ping timeout: 265 seconds]
FromGitter has joined #crystal-lang
greengriminal has joined #crystal-lang
oprypin has joined #crystal-lang
Ven`` has quit [Ping timeout: 268 seconds]
Ven`` has joined #crystal-lang
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter>
<drosehn> 42
akaiiro has joined #crystal-lang
akaiiro has quit [Remote host closed the connection]
renzhi has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 264 seconds]
Raimondii is now known as Raimondi
<FromGitter>
<sam0x17> renamed to_b to truthy and added Array support and a bunch of other (I think) intelligent defaults: https://github.com/sam0x17/truthy
<FromGitter>
<DanilaFe> Are there any conventions I should use in my code, besides the style guide on the wiki? I wrote stuff, it works, but I want to make sure it's clean / proper style
<FromGitter>
<aisrael> I just use `crystal tool format` and not worry about it
<FromGitter>
<DanilaFe> Right, but I don't just mean indentation. Are there any common patterns used in Crystal that I should know of?
<FromGitter>
<aisrael> Like what? You mean idiomatic expressions?
<FromGitter>
<DanilaFe> I'm still thinking something larger. Something along the lines of, how are bigger programs structured in Crystal?
duane has quit [Ping timeout: 248 seconds]
<FromGitter>
<sam0x17> @DanilaFe that's a wild west sort of thing right now, but the correct answer is probably along the lines of "pretty much the same way people structure large rails apps" because that is the closest thing that has lots of large apps in it
<FromGitter>
<DanilaFe> That makes sense
<FromGitter>
<aisrael> What @sam0x17 said.
<FromGitter>
<sam0x17> for me the answer is more "avoid the pitfalls of large rails apps and organize it *your* way" ;)
<FromGitter>
<aisrael> I honestly don't even think Crystal is best fit for "large, monolithic, MVC Web apps" just yet. I mean, Amber and Lucky frameworks are getting there but in terms of maturity, I'd probably go with Elixir's Phoenix or even just Rails (for all its warts) still
<FromGitter>
<aisrael> OTOH, for back-end services (hate to use the term "micro") and APIs, etc., then that's where we went with Crystal rather than Go or Rust
<FromGitter>
<sam0x17> I think crystal fits a lot better with lambda-like stuff, and microservices like you said, but https://github.com/sam0x17/gcf.cr gives you some interesting alternatives to standard microservices since you can run crystal code in a google cloud function (shameless plug)
<FromGitter>
<DanilaFe> shameless indeed. I'm also not making a web app, so I'm not sure how much the "model after rails" advice applies to me
<FromGitter>
<sam0x17> if you are making a library, it's sort of up to you, obviously one class per file is usually a good strategy (if you even have classes), but depending on what you are doing a module with a bunch of class methods might be appropriate, or using lots of modules to include functionality in your classes... granite-orm is a medium sized project that is organized fairly well in the latter regard
<FromGitter>
<sam0x17> regarding large large projects in crystal, eventually someone is going to have to write something like ccache so people can manage multi-million line projects in crystal since I've heard the compile times get really bad once you have hundreds of thousands of lines of code
<FromGitter>
<sam0x17> the way people break up large models/classes in rails is pretty universal and not just specific to web apps
nowhereFast has joined #crystal-lang
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
Liothen has joined #crystal-lang
Liothen has joined #crystal-lang
Liothen has quit [Changing host]
nowhereFast has quit [Ping timeout: 268 seconds]
nowhereFast has joined #crystal-lang
nowhereFast has left #crystal-lang [#crystal-lang]
Kepler_ has joined #crystal-lang
Kepler_ has quit [Client Quit]
alex`` has joined #crystal-lang
ashirase has quit [Ping timeout: 240 seconds]
ashirase has joined #crystal-lang
<FromGitter>
<Val> @veelenga : thanks for the crystal-ann post ! =) Could you please add a line about the in-comments *shards* support ?
<FromGitter>
<veelenga> @Val done ;)
<FromGitter>
<Val> @veelenga : thanks a lot =)
alex`` has quit [Quit: WeeChat 2.2]
hightower4 has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
Ven`` has joined #crystal-lang
Ven` has joined #crystal-lang
Ven`` has quit [Ping timeout: 256 seconds]
Ven` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<asterite> @paulcsmith really nice! It seems "class" doesn't appear in the beginning of some code snippets for some reason...
greengriminal has joined #crystal-lang
<FromGitter>
<paulcsmith> Thanks @asterite! The importer I used must have chopped that off :) I went through and added `class` to the gists!
<FromGitter>
<choallin> Thanks for the great article @paulcsmith! Lucky really does look interesting. One question though: Is there a way to implement a Graphql api yet? Or would I have to use another shard for this?
<FromGitter>
<rishavs> @paulcsmith congrats! its a great article.
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven`` has joined #crystal-lang
emeve89 has joined #crystal-lang
emeve89 has quit [Client Quit]
<FromGitter>
<drujensen> @paulcsmith nice article. love the built in check for N+1 and the override.
<FromGitter>
<drujensen> Amber has some work to do on that front. ;-)
<FromGitter>
<paulcsmith> Thanks @drujensen!
<FromGitter>
<paulcsmith> It also prevents accidentaly using unpermitted params (strong params) at compile-time. The article was a bit too long to mention that, but it's super helpful to find those issues at compile-time instead of wondering why params aren't saving :P
<FromGitter>
<drujensen> yeah, very important feature
<FromGitter>
<drujensen> another RoR’s flaw
<FromGitter>
<drujensen> What is your thoughts on the compile time comparison done by Michael Dorf?
<FromGitter>
<drujensen> Kinda unfair comparing to Ruby and Elixir but still valid IMO
<FromGitter>
<paulcsmith> I think he is right that compile times are slow. It's a known thing. But I don't think it is necessarily an "issue."
<FromGitter>
<paulcsmith> 30 seconds for a largish project is fine for me because I'm not working like I do with Ruby and Elixir. I tend to write more code because the compiler will catch most stuff. I don't need to be constantly refreshing and retrying things in specs and in the browser all the time
<FromGitter>
<emeve89> I agree
<FromGitter>
<paulcsmith> Another important thing that wasn't mentioned is that when something is wrong, the compiler tends to find the issue super fast. I don't know why that is, but it tends to be in less than a second
<FromGitter>
<drujensen> yeah, it seems like the syntax checking is very fast
<FromGitter>
<paulcsmith> So fixing stuff is a super fast feedback cycle and when it actually compiles, sure it takes longer, but it has a much higher change of working than with Elixir and Ruby
<FromGitter>
<drujensen> very true
<FromGitter>
<paulcsmith> I mean, even with mismatched types it seems to fail really fast, which is awesome
<FromGitter>
<drujensen> fail fast
<FromGitter>
<drujensen> 5 minute compile time is not going to work though
<FromGitter>
<paulcsmith> So all-in-all. I'd take the slower compile times, you just need to work differently than you would in programs that do very little type checking. It also depends on how well typed your program is
<FromGitter>
<drujensen> Is there going to be caching for compile times?
<FromGitter>
<drujensen> seems like there was discussion about that at some point
<FromGitter>
<paulcsmith> Yes 5 mins is too long, but I don't think that is a Crystal thing. Someone did a similarly sized project and it was ~30s in Lucky so my guess is it can be fixed in Amber. Probably a bug snuck in there that can hopefully be fixed
<FromGitter>
<paulcsmith> I think incremantal compilation and caching has been discussed, but it is very tricky and may require language changes. Hopefully minor changes, because I love the language as it is :D
<FromGitter>
<drujensen> probably the compiling of the templates / views
<FromGitter>
<paulcsmith> But depending on the changes it might be fine
<FromGitter>
<drujensen> couldn’t agree more about loving the language
<FromGitter>
<paulcsmith> Yes, I think the biggest annoyance for long compile times will be for designers/front-end people. Adding a class and waiting 30 seconds is pretty painful. Especially if using functional CSS where nearly everything is done by adding/removing CSS
<FromGitter>
<elorest> I have a pretty large project in amber and which I compile for arm in just about a minute. Has anyone verified his findings?
<FromGitter>
<drujensen> yes, i generated 100 scaffolds in amber with same results
<FromGitter>
<fridgerator> I did, was about the same
<FromGitter>
<fridgerator> with `--release` was 17 minutes
<FromGitter>
<drujensen> ugh
<FromGitter>
<fridgerator> less of an issue becuase you will only do that once, but still not good
<FromGitter>
<elorest> Ok. Weird thing about that is that slang uses a macro to compile the template and it should be cached. According to crystal docs.
<FromGitter>
<paulcsmith> Also, precompiled tasks makes a big diff. Lucky and I think Amber too have a lot of tasks in `bin` that run instantly, like generators. That is super nice compared to waiting a few seconds and breaking your flow :) Helps makes compile times a lot more bearable
<FromGitter>
<paulcsmith> Is it known to be a slang issue? Could you try ECR and see if you get the same results?
<FromGitter>
<drujensen> good question, testing...
<FromGitter>
<drujensen> ECR is faster. 3m25.835s
<FromGitter>
<drujensen> but still too slow
<FromGitter>
<drujensen> API only, no views 1m47.329s
<FromGitter>
<drujensen> still too slow IMO
<FromGitter>
<drujensen> 100 controllers / models are generated
<FromGitter>
<drujensen> If I recompile, its cuts ~30s off the compile time 1m20.811s
<FromGitter>
<drujensen> not sure if it caches macro generated code?
<FromGitter>
<paulcsmith> 100 controllers with how many actions in each?
<FromGitter>
<drujensen> an empty amber project `amber new demo` takes 0m16.005s to compile.
<FromGitter>
<paulcsmith> Is that first run or second? I think the most important number is subsequent runs since it caches the built shards if I'm not mistaken
akaiiro has quit [Remote host closed the connection]
<FromGitter>
<paulcsmith> Should be a few seconds on second run right?
<FromGitter>
<drujensen> 0m2.351s
<FromGitter>
<drujensen> second run
akaiiro has joined #crystal-lang
<FromGitter>
<drujensen> do you have a generator in Lucky that you can try this out?
<FromGitter>
<paulcsmith> It's not an exact comparison but Lucky was 50s first run. 30s after initial cache. I haven't spent much time investigating though because this seemed fairly reasonable
<FromGitter>
<paulcsmith> Eventually I want to do a deep dive and add type restictions to everything to help speed things up a bit
<FromGitter>
<drujensen> yeah, 30s is reasonable
<FromGitter>
<paulcsmith> We don't use any templating though so that probably helped a little bit but I'm not really sure
<FromGitter>
<drujensen> could be
<FromGitter>
<elorest> And api project isn’t using a templating language in amber either.
<FromGitter>
<drujensen> I think @paulcsmith is right that adding the types will speed it up
<FromGitter>
<elorest> Types on what though? Most variables do have types.
alex`` has quit [Ping timeout: 256 seconds]
Ven`` has joined #crystal-lang
<FromGitter>
<sam0x17> someone needs to write the equivalent of ccache for crystal to fix these compile times
<FromGitter>
<paulcsmith> It is a known issue, but caching is quite difficult to get right
<FromGitter>
<drujensen> @elorest good question. just looking at the generated code and I don’t see much to add types too
<FromGitter>
<paulcsmith> I think 30s for 700 endpoints and corresponding pages is not too bad. I'm guessing Amber can get to similar times as well
<FromGitter>
<paulcsmith> Of course faster compile times would be great, but I personally don't think it is a deal breaker either
<FromGitter>
<paulcsmith> Is Amber using any `run` macros? Maybe there is something that it's doing at compile time more time than expected?
<FromGitter>
<elorest> Every ECR/Slang template uses one run macro.
<FromGitter>
<paulcsmith> But the slow compile times are also with API endpoints right?
<FromGitter>
<paulcsmith> So seems like there might be something else causing some slow downs
<FromGitter>
<elorest> > API only, no views 1m47.329s ⏎ for 100 api cruds according to @drujensen
<FromGitter>
<elorest> What is the speed of that on recompile @drujensen
<FromGitter>
<drujensen> yes, and 1m20s on second compile
<FromGitter>
<elorest> Ok.
<FromGitter>
<elorest> What computer are you using.
<FromGitter>
<elorest> For the 100 html slang cruds I’m getting 1:47 on mine.
<FromGitter>
<drujensen> wow, nice!
<FromGitter>
<drujensen> linux?
<FromGitter>
<elorest> i7 Imac from last year.
<FromGitter>
<drujensen> hhmm, same
<FromGitter>
<drujensen> weird
<FromGitter>
<elorest> Your’s is showing i5 cpu.
<FromGitter>
<drujensen> oh, right
<FromGitter>
<elorest> Mine is 3.5ghz base with a boost of 4.2 or something.
<FromGitter>
<elorest> Still thought 2 minutes is longer than I’d like. Although this hasn’t been an issue for anything I’ve built in amber so far.
<FromGitter>
<elorest> Only have like 15 templates, and a bunch of websockets though.
<FromGitter>
<drujensen> I haven’t built anything large since they are usually SPA apps
<FromGitter>
<drujensen> right
<FromGitter>
<drujensen> I guess this is a good excuse to get a faster PC. :-)
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crystal-lang206 has joined #crystal-lang
hightower4 has quit [Ping timeout: 256 seconds]
<crystal-lang206>
Hi guys, a question, is there any editor with good suport for autocomplete crystal???...visual studio code and emacs provides syntax check but not autocomplete...thanks
<FromGitter>
<bew> Autocompletion is a work in progress
<FromGitter>
<asterite> Yeah, it's pretty much impossible to do it Ina timely manner
<FromGitter>
<bew> You can checkout https://github.com/crystal-lang-tools/scry but don't expect too much, it won't work correctly in all possible cases (it actually currently work correctly in a few cases only)
<FromGitter>
<elorest> Speaking of long compile times. I’ve been doing a lot with yocto lately and just a simple build with that takes 18 hours lol.
<FromGitter>
<bew> Wow, what does it do that take that much time?
<crystal-lang206>
thanks guys, yes seems that visual studio code is using scry but it never works...it's a bit annoying use a statically typed language without autocomplete but for now seems than I'll have work in that way
<FromGitter>
<bew> Vscode doesn't use scry by default
<FromGitter>
<bew> It uses a quick-n-dirty hardcoded database of types and methods for these types in the crystal plugin
<FromGitter>
<bew> Instead of that, you can enable scry with some configuration in the plugin iirc
hightower4 has joined #crystal-lang
<FromGitter>
<wontruefree> @drujensen I read that article and didnt like how he did not seperate out the language from the framework