Hacker News new | ask | show | jobs
by j-james 1457 days ago
I particularly like, from the syntax side:

- Python-style syntax with significant indentation

- Uniform Function Call Syntax: a.len() == a.len == len(a)

- Fully unqualified imports by default: which might seem scary to Python programmers, but works great in practice because of static typing

- All of the above makes code readable and succinct

And from a language features side:

- Compiles to C with all the architectural targets that come with it

- Compilation to C also allows for easy C interop: wrap function signatures and types and you're done

- This, in turn, means that Nim libraries can bootstrap off of the massive C ecosystem, while adding nicer APIs on top

- Extremely performant GC by default: optional Rust-style annotations can further improve performance, and you can remove all overhead and manually manage memory with C-style pointers if you'd like

- Useful compile-time templates and macros that can directly change the AST

The community is also active and helpful on IRC/Matrix/Discord/Gitter (bridged together)

2 comments

One really important thing I forgot to mention is how extendable Nim is - first class support for macros and AST manipulation is very powerful. This cuts back significantly on the amount of functionality that needs compiler magic.

So you'll see alternative (or new) implementations of core language features like async, threading, DSLs, typeclasses, traits, etc available as external packages, with just about the same user experience as if they were built into the stdlib or compiler.

>- Uniform Function Call Syntax: a.len() == a.len == len(a)

a.len() == len(a) seems like a good idea, but I'm not so sure about a.len... Isn't that a bit ambiguous?