5 ms·
When I first found Nim I was looking for a faster compiled Python. I've found something that is much better: static types, less of an emphasis on OOP, static de
by dom96 6y ago
When I first found Nim I was looking for a faster compiled Python. I've found something that is much better: static types, less of an emphasis on OOP, static dependency-free fast binaries and macros all work together well to make Nim awesome to work with but what makes Python great is retained: speed of development, ergonomic syntax, and a small learning curve.
> very weird concepts
I'm curious, what weird concepts are you referring to?
- beagle3 6y agoThe Nim forum has recurring questions about deserializing JSON that only make sense if you assume Nim is runtime dynamic like Python. And many random question start with “Python let’s you..” or “shouldn’t we make this more like Python” to which Araq rather consistently (and rightly) replies “no, because this is not Python”
- dom96 6y ago> The Nim forum has recurring questions about deserializing JSON that only make sense if you assume Nim is runtime dynamic like Python. Nim is a statically typed Python, and actually the way you can deserialise JSON is very Python-like, so I'm not sure where you got this from. Here is an example: Python: >>> import json >>> j = json.loads('{"foo": 42}') >>> j["foo"] 42 Nim: import json let j = parseJson("{\"foo\": 42}") echo(j["foo"]) # 42 https://play.nim-lang.org/#ix=2KpU https://play.nim-lang.org/#ix=2KpU
- beagle3 6y agoBut replace the last line with 3+j["foo"] in python (and respectively, echo (3+j["foo"]) in Nim), and the Python prints 45 whereas the Nim compiler greets you with ~40 lines of output asking you what exactly you meant. Just to clarify: I'm not complaining. I'm happy that the compiler bugs you to do 3+int(j["foo"]) if you're going to treat it as an int. But I don't consider Nim a statically typed Python. (Also: am a very satisfied owner of a dead-tree version of the Nim book. Thanks! Highly recommended. And dom96 is awesome in general)
- planetis 6y agoWhich post, the one forgetting that string literals in JSON are quoted or the other one that paid no attention on the nesting of JSON objects :P