4 ms·
It's an exciting week for programming languages. First Nim, then Zig. Keep up the great work!
by andrewnc 7y ago
It's an exciting week for programming languages. First Nim, then Zig. Keep up the great work!
- azhenley 7y agoAnd Crystal! https://crystal-lang.org/2019/09/23/crystal-0.31.0-released.html https://crystal-lang.org/2019/09/23/crystal-0.31.0-released....
- rvz 7y agoSorry! But Crystal was last week's news! This week is Zig's turn on HN :)
- azhenley 7y agoTo be fair, Crystal's release was the same day as Nim! But yes, now it is Zig's time! I'm happy for all of them.
- petre 7y agoI wonder why scrolling is broken once the page fully loads.
- yellowapple 7y agoSeems to be fine on Firefox (both with the mousewheel and arrow keys).
- loudmax 7y agoDoes anyone here have a good understanding of the relative merits of Zig, Crystal, and Nim? Especially compared to higher profile languages like Rust and Go? All of these languages seem to be statically compiled, and they all seem to promise both performance and safety. Rust and Go are discussed all the time on HN, so I expect most of us here have a reasonable notion of their relative benefits, for example, performance compared to ease of learning. What about these lesser discussed languages Zig, Nim, and Crystal? Are their runtime performances comparable to one another? Are they equally safe to program in? What are their relative strengths? Or does it just come down to syntax preference? I think there's value in having a lot of choices to program in, so I'm not asking which language is "best" any absolute sense. We're better off for having all of these languages coexisting. I'm just asking if anyone with experience in the three of them has any insight or impressions of their relative merits.
- steveklabnik 7y agoOne significant difference is that Zig has no GC, whereas Crystal and Nim both do.
- mratsim 7y agoI don't know about Crystal but Nim GC is optional and even on a per-type basis: Use plain object and you are on the stack Use ptr object and you can use any allocator you want (Nim's default, malloc/free or jemalloc, mimalloc, ...) Use ref object and your reference will be managed by the GC. In terms of GC, you the default is deferred reference counting (no ref counting if object is created and destroyed at the end of the scope). It accepts real-time and max-pause tunings parameters, to allow it to stay beyond those 60FPS / 144 FPS requirements You can also choose java-like mark-and-sweep, the Boehm GC, the go GC, or no GC and get a warning everytime you try to use a type that uses the GC.
- leshow 7y agoZig and Rust both don't have a runtime/GC, they should be on par with performance in C, meaning they are slightly faster than the others (of course this all depends). Go is the only one you listed that doesn't have some kind of parametric polymorphism support (generics). Rust is the only one that will validate your program is memory safe at compile time, they call this 'data race freedom'. I think in the end it's really up to your tastes which you prefer. Have a look at the tenets of each of the languages and see which resonates with you.
- mratsim 7y agoI didn't try Crystal, but Nim is definitely on par with C. Actually you can use just plain (stack) objects and ptr object and you have no GC involved. Pass the flag -d:useMalloc (or just call your preferred allocator) and you have the full C experience and speed.
- leshow 7y agoMaybe, but libraries that you use in Nim will probably use the GC, so will many functions in the std library (I imagine). Additionally, the binary you ship will still probably include the runtime & GC. So it's not really fair to say it's on par with C/Rust, there's reasons to avoid GC besides just performance. Say you are writing an embedded application for example. I don't know any Nim, so correct me if I'm wrong.