Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm a full time Nim developer and have been for over half a decade. It's completely spoiled me for other languages, it is just ridiculously productive. Rather than an ah-ha moment, it was more a gradual transition from "where's the catch?" to "there's no catch!".

The simple answer is this: anything I want to do, I can do in Nim easier than other languages, while also having direct access to C/C++/JS ecosystems as well.

Productivity:

1. I write pseudocode, it compiles fast and runs at C speeds. Programming is fun again!

2. No `::!>><>^<<@{};` cruft everywhere. Write as you want to read, even spanning multiple lines is clean and without separators.

3. Procedural: only data types and code. No need for OOP/Trait abstractions to be forced into everything (it's there if you must).

4. UFCS and overloading by parameter types make everything naturally extendable: `len("string")` can also be written `"string".len` or `len "string"` - you don't have to remember which way round it goes, and 99% of the organisational benefit of OOP emerges from this lexing rule. A compile time error if you use the same name and parameter types, so no ambiguity.

5. Sensible defaults everywhere: type inference, stack allocated and pre-zero'd variables by default, extend with GC/manual management by type (`type HeapInt = ref int`), GC is deterministic with scope based destructors and move semantics as an optimisation rather than a straight jacket, detailed opt-in control down to assembly as you wish.

6. Arguably the best compile time support of any language.

7. AST procedural metaprogramming is a core language feature. It's hard to express how powerful and well integrated this is. You can just chuck code around and recombine it effortlessly. Whether it's simple DRY replacements, automating serialisation from types, custom DSLs at your convenience, or even generating entire frameworks at compile time from data, you effectively have another dimension to programming. I can't go back to flatland, now.

8. Flexible static typing that's as strict (`type specialId = distinct int`) or generic as you want, with concepts matching any statement against a type. You can also calculate or compose types from static values which is really nice.

9. Low overhead and high control makes it great for embedded: https://github.com/EmbeddedNim

10. Fantastic FFI that can even use C++ templates, along with loads of converters/wrappers like c2nim, futhark, pas2nim that add even more sugar to FFI interop.

Portability and glue:

- Single portable executable output.

- Compiles to C89/C99, which covers basically every piece of hardware.

- Compiles to C++ so you have C++ ABI compatibility.

- Compiles to JavaScript.

- Compiles to ObjC.

- Compiles to LLVM.

- Excellent Python interop (see: Nimpy).

- Libraries for interfacing with C# and .Net.



Thank you for your thoughtful reply. Is it fair to say that Nim and Dart share similar mission statements? Any idea of a comparison between the two?




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

Search: