What is the current state of crystal toolchain? Last time I used it I really enjoyed the language but the compilation times were a bit of a turn off.
You won't ever see fast compilation times with it, and here's why: > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] I prefer Sorbet[2] for Ruby, which is pretty fast and a reasonable compromise. People complain about the verbosity, but you can't have both speed and type inference. Pick one. Some of the verbosity in Sorbet, howe…
Embed Crystal code directly in Ruby
21–30 of 65 posts
Re: Embed Crystal code directly in Ruby
#22What is the current state of crystal toolchain? Last time I used it I really enjoyed the language but the compilation times were a bit of a turn off.
You won't ever see fast compilation times with it, and here's why: > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] I prefer Sorbet[2] for Ruby, which is pretty fast and a reasonable compromise. People complain about the verbosity, but you can't have both speed and type inference. Pick one. Some of the verbosity in Sorbet, howe…
Inference is a big part of what increases Kotlin ergo over Java and while it does compile slower you are going from a very fast base so it doesn't feel slow relative to other options.
Re: Embed Crystal code directly in Ruby
#23Very, very impressive. It will be very interesting to see how much of crystal is supported, of IO and fibers and gc etc.
Re: Embed Crystal code directly in Ruby
#24Everything old is new again… https://github.com/seattlerb/rubyinline (2002)
This seems way more verbose than the project in the post.
Re: Embed Crystal code directly in Ruby
#25Earlier quoted context omitted.
You won't ever see fast compilation times with it, and here's why: > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] I prefer Sorbet[2] for Ruby, which is pretty fast and a reasonable compromise. People complain about the verbosity, but you can't have both speed and type inference. Pick one. Some of the verbosity in Sorbet, howe…
> You won't ever see fast compilation times with it, and here's why: > > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] There are fast type inference implementations. For example, the OCaml compiler is pretty fast No reason Crystal couldn't improve this part of compile time in future
My experience with F# (which was way back in version 2.0, but based on OCaml which does type inference very similarly), was that the inference would become slower as the size of the project increased, eventually taking multiple seconds. I eventually adopted a habit of adding type annotations to commonly-used functions because it mitigated the problem. These projects were not huge by any means (5-10K LOC).
There is probably a good compromise to be found here. It should be possible for a tool to suggest areas to add annotations where it would do the most good for performance. But maybe those are non issues with modern implementations.
Re: Embed Crystal code directly in Ruby
#26Earlier quoted context omitted.
You won't ever see fast compilation times with it, and here's why: > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] I prefer Sorbet[2] for Ruby, which is pretty fast and a reasonable compromise. People complain about the verbosity, but you can't have both speed and type inference. Pick one. Some of the verbosity in Sorbet, howe…
> but you can't have both speed and type inference. Pick one. With OCaml you can pick two :)
Re: Embed Crystal code directly in Ruby
#27I am asking this because in that case, can’t I run it myself and share the code with the precompiled parts so others don’t have to experience the slow start?
Re: Embed Crystal code directly in Ruby
#28Earlier quoted context omitted.
> to ruby. I also worry that it would make it too magical and difficult to figure out what code is running, where and when Coming from both python and statically-typed languages, your description 100% squares up with every experience I've had with ruby Folks are free to throw stones at the Spring Framework similarly, it's not out of bounds, but ruby seems to embrace the monkeypatch
> ruby seems to embrace the monkeypatch How recent were your experiences with this? In recent years I've seen monkeypatching treated as more of an antipattern. If you are on a project where people are doing that without very good reasons, that says more about the team than the language.
Re: Embed Crystal code directly in Ruby
#29Earlier quoted context omitted.
You won't ever see fast compilation times with it, and here's why: > type annotations are rarely necessary, thanks to powerful type inference. This keeps the code clean and feels like a dynamic language.[1] I prefer Sorbet[2] for Ruby, which is pretty fast and a reasonable compromise. People complain about the verbosity, but you can't have both speed and type inference. Pick one. Some of the verbosity in Sorbet, howe…
Could not in theory the stdlib and most used libraries be heavily type annotated to assist the compiler?
Re: Embed Crystal code directly in Ruby
#30Everything old is new again… https://github.com/seattlerb/rubyinline (2002)
But this does seem to be the first attempt at interop between crystal and Ruby, which is notable because crystal is effectively a typesafe Ruby.