9 ms·
I've got a systems level project I want to play around with, however GC is not a deal breaker for me. The languages I've been considering are Rust, Nim, Crystal
by dual_basis 8y ago
I've got a systems level project I want to play around with, however GC is not a deal breaker for me. The languages I've been considering are Rust, Nim, Crystal, and Zig. I've started writing it in Rust but the syntax is unnecessarily noisy for my taste and there are too many times I have to do similar things in a slightly different syntactic way due to some inherent idiosyncrasies, which makes the code much harder to read. In addition, it seems like there are often too many ways to do the same thing, which increases the surface area of the language.
I like Nim syntax the best, and Crystal and Zim are tied for second. I don't mind a small library / ecosystem. The main things I'm interested in are:
- I want to write once and run on Windows / Linux / Mac. (I'm not writing a GUI.)
- Concurrency and async capabilities
- Safety guarantees (both types and threads)
- Speed
I'd be interested in people's recommendations, or links to comparisons between these languages.
- audunw 8y agoIf you don't mind GC I would go for Nim (although I don't have much experience with Rust or Crystal). I've always enjoyed programming in Nim when I've had the chance. It doesn't fit all kinds of projects, but it sounds like it'll fit yours. Zig is too young to build anything significant with it. But to me, it's the most promising language for embedded and low-level development, and where you need good control of memory management. I've played around with it a lot recently and looking forward to use it more in the future.
- lilactown 8y agoYou might also consider OCaml. If the syntax offends you, ReasonML might not be a bad option.
- dual_basis 8y agoI used OCaml in a programming languages class and didn't hate the syntax, but I found the tooling relatively clunky compared to modern toolchains (for example, cargo).
- lilactown 8y agoYeah, I'm still learning how to use opam/dune after coming from BuckleScript-land. I can't yet tell if the tools are as clunky as they seem at first, or are just unfamiliar.
- laxentasken 8y agoHave you looked into Go?
- dual_basis 8y agoI did check out go. I was surprised to see that it had null, and aside from the emphasis on concurrency I didn't find anything new or interesting. This was recently posted here, and I findyself agreeing with most of the points (though I'm not quite as strongly in favor of pure functional programming as the author seems to be): http://yager.io/programming/go.html http://yager.io/programming/go.html
- jblindsay 8y agoI have spent time learning, messing around with, and evaluating each of the languages that you have listed. In the end, I decided to go with Rust for my particular application, which is a large (100k SLOC) GIS application. Rust and Zig are probably the fastest of the listed languages, although Nim and Crystal are not far behind. I found Nim to be the easiest to program in, despite my lack of Python background. The friction factor seems the lowest. Crystal is quite a nice language, but I have reservations about its future, which have been shared by its originator (the compiler may not scale well), and it does not have Windows support or support for multi-threading. If these obstacles are overcome, it could be really interesting. Nim is really great, but they have to hit v1.0 by the end of year. I'm not sure if the devs realize how important this is to the user community. Zig is quite interesting, and highly performant, but it is probably at the earliest stage of the listed languages. Rust is certainly the furthest along in development, has a larger user community and learning resources. It's not the easiest language to learn or use. I agree with your assessment of the language but will say that things get much easier once you've spent some time with Rust. The other languages that you didn't mention but are worth evaluating are D and Go. Again, they have advantages and disadvantages that may make them either more or less suited to your application.
- bmurphy1976 8y agoI'm all for a stable platform and backwards compatibility guarantees. Who wouldn't be? Who wants their code base flipped on it's head every couple months? But, why do they have to hit 1.0 by the end of the year? Who's the arbiter of this deadline?
- jblindsay 8y agoI didn't mean to imply that this is an absolute. But you may have noticed a lot of 'Nim is not a new language' sentiment in this discussion. In my mind, and I may be wrong, this is largely the result of the fact that the language has been around for a very long while without hitting v1.0. This makes the group of potential users very nervous. The longer they leave this unresolved, the more likely it is that the train will leave the station without them. It seems like now is a good time for Nim, with a lot of interest, but this must be addressed. The wonderful book Nim in Action, which I recently purchased, only makes sense if 1.0 is on the horizon. Otherwise, why bother with a published book on the language? Again, this is just my opinion but I'm sure that it's shared by at least some others. It is in my view the biggest obstacle holding the language back from more widespread adoption. I want the language to succeed and that's why I press the issue.
- atilaneves 8y agoI would also consider D
- rubiquity 8y agoYou may want to consider Pony: https://www.ponylang.org/ https://www.ponylang.org/ Pony has compile time guarantees on not having data races, dead locks, runtime exceptions. It accomplishes this in a different way than Rust. For concurrency/async, Pony is Actor based, which I find to be a joy for modeling concurrent applications. Here's a high level: https://www.ponylang.org/discover/#what-is-pony https://www.ponylang.org/discover/#what-is-pony
- gulabjamyn 8y agoPony often has breaking changes. Not yet 1.0
- dual_basis 8y agoYeah, this is exactly why I didn't consider Pony.
- dual_basis 8y agoPony looks great, but based on reading the docs it seems it is a bit too early to do much with it. Looks like they don't really have any tooling (package manager?) yet.
- rubiquity 8y agoIt is early days for Pony for sure, but it does have a package manager: https://github.com/ponylang/pony-stable https://github.com/ponylang/pony-stable The breaking changes have been minimal since I've started using it. Typically just slight changes to some type signatures. The core parts (Actors, Reference Capabilities, Classes/Traits/Interfaces) are all stable at this point. I'm amazed by how well ponyc (the compiler) works. You just run it and it figures everything out. If I could change anything in the language right now, I wouldn't mind seeing a couple of the reference capabilities renamed (trn, box, and maybe tag specifically), though I don't have any better names to offer. I'd also like if Actor Behaviour dispatch had a different syntax than Object method invoke.
- dom96 8y agoI would say that Nim ticks all of the main things you are interested in. To give you a better idea let me go into a bit more detail about your interests: > I want to write once and run on Windows / Linux / Mac. (I'm not writing a GUI.) Portability is Nim's great strength. You can even target some really obscure platforms, as long as they have a C compiler (which they likely will). > Concurrency and async capabilities Concurrency in Nim is offered via async await with first-class support for Windows, Linux and macOS (IOCP, epoll and kqueue). It's implemented 100% using Nim's macros, so you can easily dive into its implementation and modify it to suit your use case without having to mess with the compiler source code. It's all implemented in the standard library. Nim's async has also been used in production for quite some time now. One example is the Nim Forum: https://forum.nim-lang.org https://forum.nim-lang.org. > Safety guarantees (both types and threads) Parallelism in Nim is a little different than in other languages. Each thread has its own GC and memory sharing between threads is limited. This ensures safety and performance (no stop-the-world GC). > Speed Out of all the language's you've mentioned I would say that they are all pretty similar in terms of speed. Hope this helps!
- pjmlp 8y agoI would add D to the list, and eventually C# although its AOT compilers depend a bit in what toolchain you end up using.
- dual_basis 8y agoIsn't C# a second-class citizen on Linux at best?
- pjmlp 8y agoLinux is a UNIX clone, every programming language besides C on an UNIX system is a second class citizen.
- p0nce 8y ago> The languages I've been considering are Rust, Nim, Crystal, and Zig. Sorry to be unfair but: is being _new_ the prime quality of a programming language?