Hacker Newsnew | past | comments | ask | show | jobs | submit | asterite's commentslogin

Those functional languages don't have function overloading or named arguments. The type inference in Crystal works very differently. The type of a method can only be computed from explicit calls to it. In those functional languages the type can be computed independent of a call because it's trivial to do so if a function name always refers to a single entity.


> Those functional languages don't have function overloading or named arguments.

Scala has both, F# too (though function overloading is possible, I think it's not idiomatic), OCaml has named arguments, Haskell has overloading.


"Fast as C" should maybe be changed to something else. Crystal can bind directly to C functions and libraries without any overhead, plus you have pointers and other stuff. So you could really write code that runs as fast as C if you program like in C, but with Crystal syntax. That's where the tagline comes from. But of with course normal usage of the language, with its heap-allocated stuff, garbage collector and usual stuff (like Array#map, which does allocate a new array), you won't get performance like C, but it will be acceptable, and usually faster than dynamic/interpreted languages.


That's about speed (though I think Truffle/Graal make an app consume more memory). Crystal is type-safe, and no optimizing VM can do that for Ruby.

Not that type-safety is a killer feature, but that's just one difference.



That's still not the same as a compile time type-checker, it still relies on the interpreter.


The compiler takes about 30 seconds or a bit more to compile, and it has around 50000 lines of code. Do you have the few hundred lines that took you 30+s to compile?


Just dug out the code and tried again

It's 80 lines and depends on kemal, radix and kilt

`shards build --no-debug --release --link-flags "-static"` takes ~60s

I can't send the full code atm, but it basically just fetches json from an endpoint, stores it in memory, and returns it in a different format on an http endpoint


Oh, release builds do take longer.

My point of view is that while developing you don't need the `--release` flag, so you can get a more or less fluent experience. The few times where you need to release an app it takes longer, but for me that's acceptable.


I always like flipping on the release flag at then end of my work day. I treat it like a stopping point in my code, where I get to see how fast it is compared to the slow running debug executables I’d been working with all day. Great way to end a coding session.


I rarely notice the difference between release and debug executables unless i'm benchmarking or doing something super CPU heavy. I've so far deployed most of my crystal apps in debug mode because it makes the stack traces nicer because of the lack of aggressive inlining.


You could basically say the same about any language. Just switch the descriptions. For example:

C#: verbose, magical dependency injection, Microsoft, etc.

Ruby: slow

Go: ugly syntax, verbose, if err != nil, etc.

If a language works for you I see no reason not to use it :-)


Ruby's getting much faster now with recent speed improvements, JIT and recent developments by the TruffleRuby team


I wouldn't commit to any specific date. It's not something you can timebox.



"there's no point in trying to suggest changing the language to an indentation-based one"

Ok. Bit of a bummer though.


Yes, it will be available before 1.0. It's on the roadmap.


Yes, this is what Crystal 1.0 will look like. Parallelism is on the roadmap.


We do, and we will. We are working on it :-)


Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: