Hacker News new | ask | show | jobs
by thatsaguy 2759 days ago
Nim is actually great. The syntax is streamlined and you can pick it up in a few hours if you have some basic experience with python.

Because it's effectively a transpiler and it's way less opinionated than (say) Rust, I managed to use nim in embedded controllers without any special support from the compiler.

Nim suffers because it doesn't have the big push of a corporation such as Mozilla behind.

3 comments

Cool! I'm working on a project that uses javascript and a C backend so it actually might be a good fit for me.
Here is an example of such for neural network training[1]:

- Nim JS for browser display

- Nim C as a backend

[1]: https://github.com/Vindaar/NeuralNetworkLiveDemo

It might be indeed: e.g. I've implemented validation for game moves before for a web game, and reusing everything on the backend and frontend was nice
In what ways is it less opinionated than Rust?
" A source-to-source compiler translates between programming languages that operate at approximately the same level of abstraction, while a traditional compiler translates from a higher level programming language to a lower level programming language."

In other words, Nim is not a transpiler, it's a compiler that outputs C or Javascript. But the difference is just in terms of the readability and modifiability of the output. For the purpose of using it in embedded controllers, the difference doesn't matter, it's the fact that it generates C code that is of value. And yes, Nim is vastly less "opinionated" than Rust, thank goodness.

It really depends on whether you think Nim and C are on the same level of abstraction. If they aren't then yes, Nim is a compiler.

I personally believe that they aren't. But I know of a lot of people who disagree.

It depends on whether the C code generated by Nim is at the same abstraction level as the Nim source code ... clearly that's not the case, because Nim is using C as an assembly language. People acting in bad faith can down vote me all they want (I know that wasn't you, Dominik; you're a great guy) but that's what "transpiler" means. Coffeescript is a transpiler; Nim is not at all ... it does a vastly more complex transformation of the Nim source in order to generate that C code ... as you, Dominik, are especially well aware.

And there are people who will disagree about just about anything, because they are ill informed or have poor judgment or are dishonest (looking at you, White House) ... the mere fact that there are people who disagree about something is not of significance.

> I know that wasn't you, Dominik; you're a great guy

Of course not :)

Yeah, to me Nim is a compiler. However, I can see why people might refer to it as "transpilation" if we are talking Nim->JS. But yeah, please don't call Nim a transpiler, it makes us Nimians all sad.