Hacker News new | ask | show | jobs
by yeskia 2046 days ago
Compilation times can hurt too, I'm not sure if that's improved or being worked on though.
1 comments

Crystal does global type inference to be performant while “feeling like a dynamic language” - as claimed by the article. This leads to very high compilation times (which is non-linear so a program double the size will likely take more than double the time to compile) and last time I asked I was told it is not a solvable problem.
> Crystal does global type inference

I think they stepped back from this a few years ago. It's not globally inferred anymore - you need to specify some types manually.

Yes. The basic rule is that things that could be stored on the heap will need to be explicit or inferrable directly from the constructors. But as method parameters generally (except sometimes, like in procs) don't need typing it is quite possible to build full programs using only global inferrence. But that is usually not how programs are built - that would do away with things like objects and structs and other constructs that are extremely ideomatic.
Does that overhead go down if you tag lots of places with types manually?
Yes but it is unlikely to make a difference unless a major part of ecosystem changes which is unlikely to happen as it will lose its “dynamic feeling”. Even the standard library has to be compiled when you compile your project.

There is some caching to help but times are still high. IIRC the compiler is not parallel either, so having more cores won't help.

There is also a —release compile flag that you would want to use for production and it is much slower.