Unluckily, I can't replace Python with Nim as I need some science libraries not 
yet available in Nim (maybe I'll port them another day...). While my friend 
uses Nim for similar things, I chose Rust for my thesis and I had some good 
reasons:

  * when I started it, Nim lacked advanced generics it has now, Rust had traits 
long before
  * Rust's traits are everywhere in the standard library, Nim's concepts are 
not, its generics are more towards duck-typed
  * no-copy-by-default was very appealing, Rust's arr[lb..hb] provides a view 
while Nim's arr[lb..<hb] actually copies the slice (good luck with 
reimplementing everything to work on views/slices) unless immediately followed 
by assignment
  * Rust supports submodules and has better visibility rules
  * no easy moving in Nim while moving is default argument passing method in 
Rust (Nim's is by-ref for ref types and by-val for other types)
  * Rust's current macro system was enough for my needs



There are some advantages of Nim I like to use, like:

  * mature procedural macros, they have power far greater than declarative ones 
(although in Rust they operate on tokens, not AST, so Rust's macros of the same 
kind can be more powerful)
  * distinct types --- it's quite easy to make them in Rust by why bother if I 
can just {.borrow.}?



Also, some of the advantages my friend mentioned when I asked him why not Rust:

  * nicer syntax --- depends on one's personal taste, I guess
  * distinct types --- we agreed here 
  * easier to learn --- that's fairly true, Rust has a steep learning curve
  * simplicity --- it depends but I get what he meant
  * good enough performance --- of course it depends on usage and needs but 
yes, for many usecases it is



Common goodies I like:

  * highly generic with no overhead
  * no need for inheritance in simple cases: Rust's enums, Nim's variant objects
  * nice testing
  * pure joy of programming 



As for now, I think I'll start porting some of my Rust programs to Nim so they 
can be used "natively" in both.

Reply via email to