Live data from Hacker News

What is special about Nim?

hookrace.net

11–20 of 88 posts

Re: What is special about Nim?

#11
post #2

This was a helpful writeup. Nim has a lot of really nice features. Are there any problems or things you find lacking?

The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…

That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible.

(I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my guess is that they're extremely rare and usually either harmless or instantly caught by the compiler. Still, the mere possibility makes me twitchy.)

Re: What is special about Nim?

#13
post #11

Earlier quoted context omitted.

The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…

That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…

I'm personally not too happy about this, but there are restrictions on the use of underscores:

- You cannot have two underscores in a row

- You cannot have a leading underscore

Re: What is special about Nim?

#14
post #11

Earlier quoted context omitted.

The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…

That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…

I would consider it bad style to abuse the case-insensitivity like that.

It can be used for good too, for example if you have a bunch of different naming conventions in the libraries you use:

  proc some_lib_function(x: int)  = echo "hi ", x
  proc anotherLibFunction(x: int) = echo "hi ", x
  proc crAzY_LIB_WRITERS(x: int)  = echo "hi ", x
Then you can still call them consistently:

  someLibFunction(10)
  anotherLibFunction(11)
  crazyLibWriters(12)

Re: What is special about Nim?

#15
post #11

Earlier quoted context omitted.

That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…

I'm personally not too happy about this, but there are restrictions on the use of underscores: - You cannot have two underscores in a row - You cannot have a leading underscore

[deleted]

Re: What is special about Nim?

#16
post #3

Great write-up! I expected this to reference a few "normal" language features like static typing, operator overloading, or generics, but instead it was a list of some really neat off-the-beaten-track features: * Run regular code at compile time * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! * Add your own optimizations to the compiler! * Bind (…

Everything old is new again.

Re: What is special about Nim?

#17
post #11

Earlier quoted context omitted.

The idea that thisFunction and this_function are the same might be worse than the problem they're trying to solve. I cannot unfortunately have experience with larg-ish codebases in nim to tell if this would result in an actual problem or not, but the idea that I have to scan between two possible identifiers in the code can be a source of stupid bugs in the same vein as case-insensitive identifiers. On the other hand…

That seems like a really bad idea. It means that searching for an identifier requires you to allow for the possibility that there might be any number of underscores inserted anywhere. I suppose in practice you'll rely on the fact that no one will be inserting them other than at word boundaries, but it still seems horrible. (I'd worry about ambiguities of the experts exchange / expert sex change type, too, but my gues…

Certainly, I would have some sort of lint to enforce naming conventions. I don't like it at all. Searching for a function becomes a nightmare.

Re: What is special about Nim?

#18
Thanks for the great write-up. In addition to straight-up language features, what draws me to play with Nim is the full environment that has already been built up including module packaging and debugger (particular pain points when moving from Python to Golang).

Additionally, having compiled executables solves a Python pain point. I love Python, but distributing packaged executables is an ongoing pain point.

Re: What is special about Nim?

#19
Nice article.

I was going through trying to follow the instructions and hit a couple of issues:

-For "You should then add ~/.nimble/bin to your $PATH" it took me quite a while to figure I had to enter "ln -s ~/.nimble/bin/nimble /usr/local/bin/" in my Mac's terminal to do that. I guess experienced devs know that stuff but beginner here.

-There's a bug in the client.nim and server.js code where the client refers to element "foo" but the server refers to element "item". Changing them both to foo got it to work.

Nim seems kinda cool.

Re: What is special about Nim?

#20
post #3

Great write-up! I expected this to reference a few "normal" language features like static typing, operator overloading, or generics, but instead it was a list of some really neat off-the-beaten-track features: * Run regular code at compile time * Extend the language (AST templates and macros); this can be used to add a form of list comprehensions to the language! * Add your own optimizations to the compiler! * Bind (…

Everything old is new again.

Care to flesh that out a bit?
Post reply on HN