8 ms·
Nim is everything Python and Go should be/want to be, as far as language features and semantics go (haha). It has their easy-to-learn properties, but has a bet
by FridgeSeal 5y ago
Nim is everything Python and Go should be/want to be, as far as language features and semantics go (haha).
It has their easy-to-learn properties, but has a better type system, the generics system and macros are arguably more useful, and more usable than what is offered in either language.
It deserves far more attention than it currently gets.
- spaniard89277 5y agoAs someone learning programming, should I try nim for my first compiled language, instead of C++? I know it's likely harder to find answers in the Internet, but at the same time it looks easier, coming from Python and JS. If nim picks up pace in a few years and I already have a sense of it, it may be a good for prospects too.
- galangalalgol 5y agoIf you already know python and JS I think you probably won't have too much trouble with Nim, but why not add something new like memory management to learn about? Rust is complicated, but it has training wheels, and its wasm support would integrate with your JS knowledge. Alternatively modern C is still used everywhere and will teach you a lot about hardware.
- juki 5y ago> but why not add something new like memory management to learn about? You can learn that with Nim too. It supports manual memory management like C. The new ARC/ORC GC also works more like modern C++ than a traditional GC. > its wasm support would integrate with your JS knowledge Nim can also compile to JS. Or you could compile it first to C and then compile that to wasm, although that's not supported out of the box.
- galangalalgol 5y agoThose are good points. I have found that languages that don't force me to use a feature don't teach aa well as ones that do. I usually don't want to use those languages later though ( java and oop or Haskell and functional) because I like having options. Nim gives you lots of options it sounds like.
- deleted 5y ago[deleted]
- DarkCrusader2 5y agoNot OP but will definitely recommend Nim if you are intimidated by C++. Nim first compiles to C and then that C code is compiled to binary. If you know python already, you will feel right at home and you get better performance and a great type system and metaprogramming. But the eco-system is definitely not as mature as Python or JS. The documentation is good enough that I don't need to google most of the stuff while writing Nim, having types definitely help with that.
- nicoburns 5y agoConsider either Rust or Go of you want something easier than C++, but that still has a large community and lots of learning resources.
- vlovich123 5y agoGo yes. Rust? I wouldn’t say that Rust is easier although I may be biased with my long C/C++ background. The ownership model is a pretty complex thing to learn. I guess maybe if you Box a lot? It does have an easier on-ramp story for getting started/adding dependencies and that may be important for getting started.
- nicoburns 5y ago> The ownership model is a pretty complex thing to learn It is, but if you want to write C or C++ that doesn't crash, or just silently work incorrectly then you have to internalise these rules anyway. And having a compiler that gives you a helpful error message when you get it wrong is much easier than getting a segfault at runtime that may not even occur in a proximate part of the code. Let me put it this way: in 5 years of using Rust I am yet to need a debugger, and only need even println debugging rarely.
- vlovich123 5y agoThat’s not strictly true IMO. There are things that are trivially expressible in C++ that require a lot of complexity on the Rust side to prove to the compiler the code is safe. I don’t disagree with you on the safety aspects* and 100% real production code should really be starting in Rust. From a learning perspective though… not as sold yet. There’s a lot of things nicer (the stdlib is 100x better and more ergonomic and more pythonic in terms of “batteries included”). There’s a different set of edges though and none of the ownership concepts you learn really transfer anywhere else so you’re learning Rust’isms but not general systems programming things (just like goroutines teach you Go’isms and not what high performance thread safety means). * The debugger claim feels specious because segfaults aren’t the only source of bugs that need debugging. How do you deal with an unexpected panic or logic bugs?
- auxym 5y agoI'd recommend it. The syntax should make you feel at home if know python, though the type system (and std lib) does make it feel like a very different language once you use actually use it. One advantage over C++ is that you don't need to learn make, IDEs or a complex build system. The nim compiler and the nimble package manager just takes care of building for you. "nim c main.nim" and off you go, ending up with a single executable, no matter how many imports, modules, etc you have. I do recommend this as a gentle introduction: https://nim-by-example.github.io/ https://nim-by-example.github.io/ and recommend you use VS Code with the Nim extension by saem.
- rthomas6 5y agoI would recommend just vanilla C for maximum learning value. Learning about stack vs heap, pointers, memory allocation, etc. lets you learn more about what the computer is actually doing. It will make the computer seem less like a magic box, and you will see the things other languages abstract away.
- BiteCode_dev 5y agoI like Nim, and probably will learn it at some point. But no, Nim is not everything "python should/want to be". The name case insensitivity and the implicit imports on the global namespaces are perfect examples of stuff that are better in Python.
- 1_player 5y agoYes, you have listed the two things that have stopped me from giving Nim a chance. I especially dislike the global namespaces, it makes it very hard to understand where a function is defined.
- xigoi 5y agoUse go-to-definition in your editor.
- xigoi 5y agoThe global namespacing is what allows UFCS to work. You can rewrite parseInt("6") to "6".parseInt, but you can't rewrite strutils.parseInt("6") to anything.
- nerdponx 5y agoIMO people really should stop comparing it to Python, it's a very different language.
- idoubtit 5y agoYour opinion contradicts the official description of Nim on the language's home page: > Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Also, the "Features" page contains "Inspired by Python" twice, and "concepts from Ada and Modula" once.
- rsyring 5y agoI don't mind the comparison but do wish the comparison wouldn't so often be "it's a better Python." I've been programming Python 14+ years and I've dabbled in Nim and I agree it's a very different language. Yes, there are similarities, but my expectations about it being a lot like Python from the community and docs actually led to some significant frustration and discouragement. "Inspired by"..."borrows concepts from" are better descriptors IMO. But it would be better if an unqualified "it's like Python" disappeared.
- The_rationalist 5y agoWhat added value does it have over Kotlin?