4 ms·
I've written a large-ish amount of Nim code on personal projects while using Python day to day at work, and almost every time I'm working with Nim my brain is s
by matthiaswh 6y ago
I've written a large-ish amount of Nim code on personal projects while using Python day to day at work, and almost every time I'm working with Nim my brain is screaming at me at how unlike Python it is.
Nim took some inspiration from Python's syntax, but the similarity is only skin deep. The construct of the language is very, very different resulting in code that usually looks and is structured differently.
IMO going into Nim thinking it will be like Python but compiled! and faster! with types! is not a good way to approach it. It is an entirely different language altogether.
- rattray 6y agoI'm curious - how would you describe the qualitative differences in code structure that results? Are there ways in which Nim nudges you to structure your code in better ways than you would in Python? Are there footguns?
- planetis 6y agoYeah, it values composition over inheritance (mentioned in the official tutorials) and discourages you from using methods and other OOP concepts. It's by far a procedural language. Functional style is also not preferred either, imho a good thing, fp does not result in fast code.
- pjmlp 6y agoActually it feels more like a Python flavoured Object Pascal.
- johnisgood 6y agoI mentioned in what ways it is similar to Python, but of course it is different to it in other ways.