Live data from Hacker News

Nim in 2020: A Short Recap

nim-lang.org

51–60 of 121 posts

Re: Nim in 2020: A Short Recap

#51
post #4

In what cases is Nim a better option than Rust? Would be great if anyone with more experience can share more information.

I consider Nim to be a compiled, faster Python. Nim is very easy to read and understand, and prototype in, vs. Rust.

I consider Nim to be a better Go.

Re: Nim in 2020: A Short Recap

#52
post #19
post #12

Too bad nim uses a whitespace-sensitive syntax like python, something I personally dislike.

That's actually one of it biggest advantages over the competition. I wish more languages cared about readability.

I wish IDEs/text editors enabled code to be rendered and edited in different ways: braces, do/end, whitespace. That could very well be a good way to resolve these disagreements.

Re: Nim in 2020: A Short Recap

#53
I've used Nin for this years advent-of-code challenge. Never used Nim before but there are some great tutorials [1].

It's a nice language with a great standard library. Implicit static typing is great after a bit of getting used to. Some things like tuples or "Object Variants" are fun to use.

The only thing I'm missing is strong debugging support. You can use GDB and there is even some basic support for debugging in VSCode (through gdb behind the scenes). But most of the time I had to fall back to simple "echo" debugging because names were sometimes mangled, variables were not displayed or lines in nim did not correspond with lines in the final output, making debugging a chore. Unfortunately someone once started to write an embedded debugger (ENDB) for all platforms, but development stopped.

What's your opinion on this? In some way I would love to use Nim more in the future, but I'm afraid, that the larger the codebase gets, the more I'd suffer just because of debugging...

[1] https://nim-lang.org/docs/tut1.html

Re: Nim in 2020: A Short Recap

#54
post #40
post #16

Earlier quoted context omitted.

You're free to use Golang or another language. Nim has a great feature set and will be a good fit for Python or Ruby teams wanting a more performant language. At the same time, it's more expressive than Golang and will fill a niche Golang couldn't meet. I like that we now have Golang, Rust, Swift, Nim, and Kotlin. They're all doing new things and excelling at their own niches.

I already use golang for work, and now I'm just doing a little toy project in nim. What I like most about nim is that it has generics, and produces binaries with small size. I'm creating a graphical program with a http server running in the background, and mixing asynchttp with UI threads is a bit of a pain in the posterior. Granted, I'm new to the language, I'm considering using channels, maybe that will make it eas…

> I'm creating a graphical program with a http server running in the background, and mixing asynchttp with UI threads is a bit of a pain in the posterior. Granted, I'm new to the language, I'm considering using channels, maybe that will make it easier to share state between threads.

Ideally you shouldn't need to use UI threads and instead integrate the async loop into the UI's event loop or vice versa. Happy to advise more if you can let me know which UI framework you are using :)

This being said, I am hoping to implement better support for using `spawn` and channels with async, i.e. the ability to await the result of `spawn` or a channel. I think that will make a lot of use cases much easier.

Re: Nim in 2020: A Short Recap

#55
post #12

Too bad nim uses a whitespace-sensitive syntax like python, something I personally dislike.

This comes up all the time, but in Nim you can almost always use parenthesis instead of whitespace [1] if you really love that redundancy/style.

[1] https://forum.nim-lang.org/t/6897#43184

Re: Nim in 2020: A Short Recap

#56
post #44
post #4

In what cases is Nim a better option than Rust? Would be great if anyone with more experience can share more information.

The relative simplicity of the language is a feature. I can imagine introducing Nim to embedded/microcontroller firmware developers that only know/use C99 now. I cannot imagine introducing Rust - while a great language, it is C++ level complexity - and that is not always warranted.

Nim fits great on microcontrollers! Benefit is that it compiles to C and therefore can run anywhere C can. It also lets you reuse all the rest of the embedded C environment and build tools, which given the nature of embedded toolchains is handy for hitting the ground running. Rust's standard library/runtime binaries are really heavy compared to Nim's.

Re: Nim in 2020: A Short Recap

#57
post #12

Too bad nim uses a whitespace-sensitive syntax like python, something I personally dislike.

I also have many thing I don't like in every language I use, but I still use them because they're still useful. If we're talking about syntax for example, for me it is Clojure > Python > Elixir >> Ruby, but I know lots of people that thing Ruby is the most beautiful language on earth.

BTW, if we are talking about things that really goes on nerve for me it is the fact that Golang doesn't compile when there is unused imports in the module, so I can't simple comment a random line and try to compile it again. But I know people that like this because they editor are configured so the import is automatically removed. Ok I guess, but I still find this behavior annoying (I would much prefer that this was a compiler warning).

Re: Nim in 2020: A Short Recap

#59
post #4

In what cases is Nim a better option than Rust? Would be great if anyone with more experience can share more information.

This is subjective, but I prefer Nim's python-like scoping syntax; ie no semilonons nor curlybraces. Someone else in this thread posted a comment to the opposite effect! That said, I don't see a compelling class of projects to use it on instead of Rust.

I'll consider Nim next time I'm looking at making a python project. However - most of the times this happens is if I'm making a web backend or doing something numerical, where Python has a library advantage.

Re: Nim in 2020: A Short Recap

#60
post #19

Earlier quoted context omitted.

That's actually one of it biggest advantages over the competition. I wish more languages cared about readability.

Readability is exactly the reason why I prefer explicit start/end markers, and dislike the Python-like implicit style. So yeah, for me it makes the language less readable, that is, it makes it harder to parse the code as I read it. Your mileage may vary indeed...

readability verbosity
Post reply on HN