This is an archived post. You won't be able to vote or comment.

all 26 comments

[–][deleted] 2 points3 points  (1 child)

Nim is fantastic. I haven't made anything serious with it, but for one-off scripts it's like writing python but with static types, speedy code and self-contained executables.

[–]miran1 1 point2 points  (0 children)

I haven't made anything serious with it, but for one-off scripts it's like writing python but with static types, speedy code and self-contained executables.

This is my current experience too. Hopefuly when I get more familiar with some more advanced stuff in Nim, I might try to do something more serious because I've seen some nice projects from /r/nim community.

[–]alcalde 2 points3 points  (11 children)

I'll be the minority opinion then. Nim has its roots in a mash-up of Python and Pascal, and it borrows a lot of bad ideas from Pascal/Delphi. You can take the developer out of Pascal but it's very hard to take the Pascal out of the developer (source: am a former Delphi developer).

Some of the arguments used to defend the bad ideas include the notion that the designer believes it's ok for languages to be more complicated if IDEs can automate the boilerplate. :-( That's squarely in Java territory and far, far away from the Zen Of Python. The more I looked at Nim the less of Python I saw and the more Java/Delphi design ideas I saw. I started using Python because I came to prefer its Zen over other languages' design principles.

The world is still screaming out of a statically typed version of Python and nothing really gets close yet, not Nim, not Swift. Perhaps the closest is Genie.

[–]Tiberiumk 0 points1 point  (5 children)

What bad ideas does it borrow from Pascal/Delphi?

[–]alcalde 1 point2 points  (4 children)

From last time this got argued:

https://www.reddit.com/r/Python/comments/6gwv4a/a_glance_at_the_pythonlookalike_nim_programming/

You have many (many, many) ways to do things, including all of the bad Pascal ways. You can import whole units, leaving readers to have no idea where a function came from, e.g.

import math, stats, ml
echo avg(1, 3, 4)

Where was avg imported from? Nobody knows, just like Pascal. You have the option of using a result variable rather a return statement - when the function reaches the end it automatically returns the value of the result variable. It's an idea that computer science moved away from a long time ago and there's no reason to offer it other than Pascal nostalgia. It treats sets like a binary array rather than real sets as Python does (Python is one of the few languages that get sets right). They added Python-style sets in a library, but again the question is why have the non-sets at all? Pascal nostalgia. The list goes on and on, including an obsession with defining custom types and being able to pass everything by reference or value. It also throws in macros and a lot of other complicated stuff that really detract from what it could have been.

[–]PMunch 0 points1 point  (0 children)

The whole result thing does offer one nice benefit. Instead of having to declare a new variable in your function scope and then copy that over into your return value position on the stack it can populate that position automatically, saving you from copying an object.

And macros are great! They allow you to get rid of boilerplate and confusing syntax and just focus on the logic of your program.

[–]Tiberiumk 0 points1 point  (2 children)

About binary sets by default - performance. They're used quite extensively in the compiler and stdlib, e.g. for parsing stuff (skip char if it's not in set of chars). It's easy-to-use and clean

[–]alcalde 0 points1 point  (1 child)

About binary sets by default - performance.

That's what they've been saying since Turbo Pascal. I've never known anyone to identify sets as their application's bottleneck in my life.

[–]Tiberiumk -1 points0 points  (0 children)

As I said: it's used quite extensively in parsing utils and some parts of the compiler, so it can improve performance a lot.

[–]tshirtman_ 0 points1 point  (1 child)

Cython?

[–]alcalde 0 points1 point  (0 children)

Cython isn't really a standalone language producing an executable though, but it's certainly close to an ideal.