Live data from Hacker News

Nim Programming Language 0.14.0 released

nim-lang.org

41–50 of 58 posts

Re: Nim Programming Language 0.14.0 released

#41

There are several languages similar to Nim these days, and they're all very exciting. For example, Nim, Rust, D, Go, and probably others I'm forgetting. Does anyone know of some chart that compares them based on their features and priorities? Maybe something in the spirit of https://mobile.twitter.com/nixcraft/status/73938379662612889... but with more areas of comparison and less trying to be funny?

I'll try to give it a go for Rust, Nim, and Go. Rust: Wants to replace C++ as an expressive systems programming language. Syntax derived from C++. Emphasis on const correctness. Makes use of some functional programming concepts. Extensive metaprogramming. No garbage collection by default. Interface based polymorphism. The type system tracks memory ownership helping to prevent some classes of error at the cost of more…

It should probably also be worth mentioning that while the syntax is reminiscent of Python, much of Nim's semantics are derived from Modula-3. If you're familiar with Pascal-like languages, you'll find yourself right at home with Nim.

(and, on a side note, Go has a little Wirth in it too: it was concepted as "C meets Oberon", but what it borrowed from Oberon was its simplicity, and it hasn't kept nearly as many Wirthian quirks as Nim)

Re: Nim Programming Language 0.14.0 released

#42
post #3

I still don't understand how can you (efficiently) debug something like this that compiles to another language?

GCC supports some special pragmas that Nim puts in the generated code. It then transparently maps the Nim source to the compiled instructions. This is exactly like JS sourcemaps for languages that compile to JavaScript. I haven't tried it that much, but it seems to work pretty well.

To be honest, I never managed to get familiar with many debuggers in a fashion that I could use them productively, except for Microsoft's Visual Studio tools (VC++, good ol' VB6 :-)). I know enough GDB to survive, and from what I've seen Nim works there almost just as well as plain C code.

There was a special debugger for Nim that worked by inserting instrumentation code during compilation, but that seems to have been deprecated.

Re: Nim Programming Language 0.14.0 released

#43
post #3

I still don't understand how can you (efficiently) debug something like this that compiles to another language?

So many circular answers. Maybe someone could give some pointers to @Keyframe1 about best practices in nim, I'm sure he knew gdb worked with nim.

That happens a lot on HN and it is frustrating. It's clear that people have just the barest of experiences with a topic and then speak with authority, to the detriment of others. I try not to comment on things I don't know about and if I do, then I make it clear that I am extrapolating and don't try to come off like an expert because I can google a topic.

Re: Nim Programming Language 0.14.0 released

#44
post #3

I still don't understand how can you (efficiently) debug something like this that compiles to another language?

GCC supports some special pragmas that Nim puts in the generated code. It then transparently maps the Nim source to the compiled instructions. This is exactly like JS sourcemaps for languages that compile to JavaScript. I haven't tried it that much, but it seems to work pretty well. To be honest, I never managed to get familiar with many debuggers in a fashion that I could use them productively, except for Microsoft'…

Alright, thanks everyone! Mystery solved! :)

Re: Nim Programming Language 0.14.0 released

#45

Earlier quoted context omitted.

So many circular answers. Maybe someone could give some pointers to @Keyframe1 about best practices in nim, I'm sure he knew gdb worked with nim.

That happens a lot on HN and it is frustrating. It's clear that people have just the barest of experiences with a topic and then speak with authority, to the detriment of others. I try not to comment on things I don't know about and if I do, then I make it clear that I am extrapolating and don't try to come off like an expert because I can google a topic.

I submit to useless comments too, but not when there's already 7 times the same snub one in a row already.

Re: Nim Programming Language 0.14.0 released

#46

There are several languages similar to Nim these days, and they're all very exciting. For example, Nim, Rust, D, Go, and probably others I'm forgetting. Does anyone know of some chart that compares them based on their features and priorities? Maybe something in the spirit of https://mobile.twitter.com/nixcraft/status/73938379662612889... but with more areas of comparison and less trying to be funny?

You've got a couple of really good answers, but there's another really important dimension: popularity. Choosing a popular language allows you to work with others, to hire people, to pass your project on, to allow your github repos to get popular, et cetera. For that reason, I don't believe that Nim & D offer enough advantages and differences over Rust & Go that it outweighs their lack of popularity and hipness. Of c…

Isn't D used by rather big companies today?

Re: Nim Programming Language 0.14.0 released

#47
post #9
post #3

I still don't understand how can you (efficiently) debug something like this that compiles to another language?

You mean like how C compiles to assembly?

That's not a good analogy, because C doesn't just compile to assembly in any modern compiler. It compiles to assembly plus DWARF, which is an extremely expressive metalanguage (far beyond #line) for describing the mapping from the generated code back to the source. C has no mechanism for inserting raw DWARF DIEs, while assembly does.

Re: Nim Programming Language 0.14.0 released

#48

There are several languages similar to Nim these days, and they're all very exciting. For example, Nim, Rust, D, Go, and probably others I'm forgetting. Does anyone know of some chart that compares them based on their features and priorities? Maybe something in the spirit of https://mobile.twitter.com/nixcraft/status/73938379662612889... but with more areas of comparison and less trying to be funny?

I'll try to give it a go for Rust, Nim, and Go. Rust: Wants to replace C++ as an expressive systems programming language. Syntax derived from C++. Emphasis on const correctness. Makes use of some functional programming concepts. Extensive metaprogramming. No garbage collection by default. Interface based polymorphism. The type system tracks memory ownership helping to prevent some classes of error at the cost of more…

As a Rust developer, this strikes me as a really good, and fair, description of the three languages. Thanks for writing it up :)

Re: Nim Programming Language 0.14.0 released

#49
post #4

Earlier quoted context omitted.

Pretty much the same way you can any other language. GDB/LLDB works fairly well with Nim, but personally I just use a couple `echo` statements when I need to debug anything.

`printf` debugging is still often the easiest way to go.

GDB looks intimidating, but once I decided to try it I'd never go back to printf debugging.

Re: Nim Programming Language 0.14.0 released

#50
post #46

Earlier quoted context omitted.

You've got a couple of really good answers, but there's another really important dimension: popularity. Choosing a popular language allows you to work with others, to hire people, to pass your project on, to allow your github repos to get popular, et cetera. For that reason, I don't believe that Nim & D offer enough advantages and differences over Rust & Go that it outweighs their lack of popularity and hipness. Of c…

Isn't D used by rather big companies today?

Yes, but still rarely for core technology. https://dlang.org/orgs-using-d.html
Post reply on HN