4 ms·
The syntax is what attracts me to Nim too. Why use Rust over Nim in this case? Is it Rust's static lifetime constraints? Is there some feature you would miss
by arc776 5y ago
The syntax is what attracts me to Nim too.
Why use Rust over Nim in this case?
Is it Rust's static lifetime constraints? Is there some feature you would miss if you used Nim instead? Or would you prefer to use Rust because more organisations are using it?
- k__ 5y agoI like the lifetimes, the traits, the pattern matching, but also that it's used by more people, yes
- cb321 5y agoNim's concepts [0] are sort of like Rust's traits or Haskell's typeclasses - maybe more expressive in some ways. Pattern matching can be added on as a simple library and has been done several times, maybe most pedagogically outlined here [1]. Lifetime annotations just seem unproductive to me. Nim with ARC/ORC does have safe [2], automatic memory management without "a GC" or need for lifetime annotations. [0] https://nim-lang.org/docs/manual_experimental.html#concepts https://nim-lang.org/docs/manual_experimental.html#concepts [1] https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matc... [2] https://uploads.peterme.net/nimsafe.html https://uploads.peterme.net/nimsafe.html
- arc776 5y agoThanks for your reply. It's interesting to know what the perceived weaknesses and strengths are. Nim does have pattern matching but it's rarely used, whereas it seems to be used a lot in Rust (probably because of the prominence of enums). Nim has static lifetime management, but it's mainly used for eliding and thread safety (for now). Traits are an interesting feature, and make a good example of why I'm so bullish on Nim: someone has already replicated them with a macro: https://github.com/haxscramper/nimtraits https://github.com/haxscramper/nimtraits The popularity critical mass thing is mainly getting eyes on the language, but I think Nim has a slight advantage in that it's incredibly cooperative with its compile targets and FFI. Like Python, it's great for good glue code and 'scripting' without the performance penalty, and I hope that helps it meld into people's toolboxes over time.