Nim Programming Language 0.14.0 released
nim-lang.org
nim-lang.org
We've got two internal tools that are written entirely in Nim, and it's been brilliant pretty much all the way through. The rough edges of previous versions are steadily sanded away, and our code becomes more expressive with each version. The biggest thing I'm looking forward to (once v1.0 rolls round) is having the "not nil" specifier be the default for all types. That's going to bring it in line with the other static typing checker we use regularly (Flow) which will be a boon to those of us (mainly me) that live in both worlds most days heh.
When using stuff like JS, the possible nulls are a bigger problem than a wrong type in general (still a problem, but IMO not as significant) still systems like TypeScript started without it.
(I add this not as a refutation, but merely because I found it amusing.)
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.
D somewhat suffers from trying to do everything at once. There are lots of discussions.
Yes, I think this is what's driving my gut feel. Go feels quite ... hammer-y. Explicit iterators, very few "niceties", etc.
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
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-...
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.
(and, on a side note, Go has a little Wirth in it too: it was concepted as "C meets Oberon", but what it borrowed from Oberon was its simplicity, and it hasn't kept nearly as many Wirthian quirks as Nim)
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.
still open :-(
- https://hookrace.net/blog/what-makes-nim-practical/#debuggin...
- https://hookrace.net/blog/writing-an-async-logger-in-nim/#op...
Edit: You can of course also change the program itself, using echo and writeStackTrace to figure out what's going on.
https://en.wikipedia.org/wiki/Compiler "A compiler is a computer program (or a set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language), with the latter often having a binary form known as object code."
For example, at the beginning of each function call, you insert a function call that pushes a new stack frame into some global stack, and store the function's arguments. Then, just before every return from the function, you pop the stack frame. When the program crashes, you write the stack to a JSON file, and use a language-specific debugger to view it.
[1] http://ftp.gnu.org/old-gnu/Manuals/gdb/html_chapter/gdb_11.h...
To be honest, I never managed to get familiar with many debuggers in a fashion that I could use them productively, except for Microsoft's Visual Studio tools (VC++, good ol' VB6 :-)). I know enough GDB to survive, and from what I've seen Nim works there almost just as well as plain C code.
There was a special debugger for Nim that worked by inserting instrumentation code during compilation, but that seems to have been deprecated.
Am I missing something here?