Live data from Hacker News

What is special about Nim?

hookrace.net

21–30 of 88 posts

Re: What is special about Nim?

#21
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 (…

As a pythonista one thing that struck me in the code fragments is zeroes and ones appearing everywhere. It looks very easy to have off by one errors. (It is very rare to have off by one errors in Python due to the way counting and ranges work.)

Re: What is special about Nim?

#22
post #20

Earlier quoted context omitted.

Everything old is new again.

Care to flesh that out a bit?

Ah, yes, I remember back in 1959 when we all was rocking the Cobol and I used to auto compile straight to Javascript with a Future module so magnificent that it auto-compile-manifested a V8 JS engine with which to run it. Deal with that boring Nim compiler.

Re: What is special about Nim?

#23
post #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 el…

I have done it in the same fashion as I've done it for Golang and others:

Add a line to your ~/.profile

#add Nim-lang to path

export PATH=/Users/user/nim/nim-0.10.2/bin:$PATH

In the same terminal window, run 'source ~/.profile' to run the file and update the path. Creating a symbolic link like you did is fine as well.

Re: What is special about Nim?

#24
post #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 el…

> -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.

Actually you should add "export PATH=$PATH:$HOME/.nimble/bin/" in ~/.profile, ~/.bashrc, ~/.zshrc or whatever your shell requires.

> -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.

Thanks, fixed.

Re: What is special about Nim?

#25
post #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 el…

I would recommend you to do:

  export PATH = $PATH:~/.nimble/bin
instead of creating a symbolic link to /usr/local/bin. That way if you put a new binary in ~/.nimble/bin, i.e. if you have ~/.nimble/bin/foonim, it will work without you having to do

  ln -s ~/.nimble/bin/foonim /usr/local/bin/

Re: What is special about Nim?

#27
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…

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.

Is it not good enough to have specific grep tools? nimgrep for example, and there are procs for working with this IIRC.

Re: What is special about Nim?

#28
post #27

Earlier quoted context omitted.

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.

Is it not good enough to have specific grep tools? nimgrep for example, and there are procs for working with this IIRC.

I prefer to have a consistent code base, then I can use the internal tools of my editor, which are not aware of Nim's identifier rules.

Re: What is special about Nim?

#29
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…

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.

The Nim compiler offers a set of tools intended for use in IDEs ant text-editors that help with this. Besides the style insensitive grep, there are also a compiler-assisted "go to definition" and "list references" commands.

Re: What is special about Nim?

#30
Nim is great, and this article is great, except until now no article about nim managed to sell it to me like a simple Golang example including channel and go routine.

Could any Nim advocate demonstrate a simple program that:

less than 50 loc

shows the greatest strength (1 killing selling point is enough)

Post reply on HN