4 ms·
There are several languages similar to Nim these days, and they're all very exciting. For example, Nim, Rust, D, Go, and probably others I'm forgetting. Does an
by sdegutis 10y ago
There are several languages similar to Nim these days, and they're all very exciting. For example, Nim, Rust, D, Go, and probably others I'm forgetting. Does anyone know of some chart that compares them based on their features and priorities? Maybe something in the spirit of https://mobile.twitter.com/nixcraft/status/739383796626128896 https://mobile.twitter.com/nixcraft/status/73938379662612889... but with more areas of comparison and less trying to be funny?
- deathtrader666 10y agoThoughtWorks has something called "Technology Radar". They prioritise stuff that may or may not shape the future.
- michaelcampbell 10y agoAs a counterpoint: https://twitter.com/bodil/status/597766837548507136 https://twitter.com/bodil/status/597766837548507136 (I add this not as a refutation, but merely because I found it amusing.)
- Symmetry 10y agoI'll try to give it a go for Rust, Nim, and Go. Rust: Wants to replace C++ as an expressive systems programming language. Syntax derived from C++. Emphasis on const correctness. Makes use of some functional programming concepts. Extensive metaprogramming. No garbage collection by default. Interface based polymorphism. The type system tracks memory ownership helping to prevent some classes of error at the cost of more cognitive overhead. The standard library is also written in a way that makes it hard to break things. The only one of the three that can easily be used to write libraries that can be called from other programming languages. Medium complexity to learn. Nim: Slightly higher level than Rust. Reference counting garbage collection which can be turned off, but heaps are by default local to threads. Syntax derived from python. Emphasis on const correctness. Extensive compile time evaluation facilities. Object oriented polymorphism (for now). Sadly allows null by default for now. Extensive metaprogramming. Medium complexity to learn. Go: Hightest level of the three. Traditional garbage collector. Interface based polymorphism. Simple and easy to pick up. All three have good stories about multithreading. All three do their best to fix warts in C++ in things like declaration mirrors use syntax. All three start with the chainsaw turned off so you won't cut off your foot unless you're doing something genuinely dangerous like writing an OS or compiler. For me, I'd use Rust for writing security critical or OS level things like kernels, system libraries, important utilities, and web browsers. Nim for small team applications where you can afford to be a bit clever and Go for large team projects where cleverness has to be discouraged. I'm not a huge expert in any of these so there's probably important things I'm overlooking.
- jadbox 10y agoOn that spectrum, I'd put D between your definition of Rust and Nim. Currently it does use a GC by default, but you can easily work above it when needed. Soon(tm) you will be able to specify what kind of GC to use (eg. provide your own) and the stdlib will adapt to it.
- qznc 10y agoI consider D stretching from Rust over Nim to Go. D wants to be a very comprehensive language. It is not as focused as the other three. D somewhat suffers from trying to do everything at once. There are lots of discussions.
- michaelcampbell 10y agoNim feels higher level to me than Go; can you educate me on how you drew the opposite conclusion? Maybe I'm looking at something wrong.
- Symmetry 10y agoJust because the garbage collector is optional and the slightly higher emphasis on performance. Also the way it compiles to C. I have using Nim to program a microcontroller on my todo list but I'm not sure how I'd go about doing that in Go. It's weird though because Nim is certainly more expressive than Go is and usually that goes with being higher level.
- michaelcampbell 10y ago> Nim is certainly more expressive than Go is and usually that goes with being higher level. Yes, I think this is what's driving my gut feel. Go feels quite ... hammer-y. Explicit iterators, very few "niceties", etc.
- dlrk 10y agoFor example, You can drop into c types using e.g. cstring and cint. Turn off or direct the gc. Manage memory for individual vars using the {.untracked.} pragma, c_malloc and c_free; easy integration of c libraries for obvious reasons; get pointers to things if you need them with ptr. Have a look at some of these in the manual. Gc stuff is in the standard library somewhere. This is an example I used recently: http://forum.nim-lang.org/t/567 http://forum.nim-lang.org/t/567 Don't think it counts as low level but templates and macros are also pretty powerful if you need them. http://hookrace.net/blog/introduction-to-metaprogramming-in-nim/ http://hookrace.net/blog/introduction-to-metaprogramming-in-... I was drawn to it because it is high level, expressive and safe, but you can turn all this off when you need to and keep those bits contained. I'm using it with opencl. Can't really comment on rust and have limited exposure to go.
- jadbox 10y agoI've been leaning on Go lately because it has a large module community already. Nim, D, Rust are all on my radar to use once library maturity happens. For example, I need solid AWS, Azure, GEngine SDK support.
- bryanlarsen 10y agoYou've got a couple of really good answers, but there's another really important dimension: popularity. Choosing a popular language allows you to work with others, to hire people, to pass your project on, to allow your github repos to get popular, et cetera. For that reason, I don't believe that Nim & D offer enough advantages and differences over Rust & Go that it outweighs their lack of popularity and hipness. Of course others will say the same thing about Rust & Go: C, C++ and Java are much more popular and do currently fill basically the same niches as Rust & Go. You have to draw the line somewhere. It just happens that my line is drawn above Nim & D, but below Rust & Go. Nim & D look like really awesome languages, though. They're just one killer project away from being popular, the way that Rails made Ruby popular. I would not be particularly upset if the situation reversed, if Nim & D got popular while Rust & Go got unpopular.