Live data from Hacker News

Nim 2.0 thoughts

forum.nim-lang.org

101–110 of 150 posts

Re: Nim 2.0 thoughts

#101
post #63

Earlier quoted context omitted.

Nim compiles to C and then runs GCC (not LLVM) to compile the binary. Overall, it's much faster than Go and Rust.

I get that Nim can be faster than Go but I don't see how it can be faster than Rust, could you please elaborate as to why?

They probably mean the compilation is much faster than Rust.

Re: Nim 2.0 thoughts

#102
post #21

Earlier quoted context omitted.

Then you end up with an ecosystem with mixed conventions. Not good IMO.

You can literally do whatever you want with any library you use in your own codebase and have a consistent convention in your own code regardless of what your dependencies' authors preferences are. In other words, if the library authors used camelCase but you want to use snake_case in your code, you just do it. It's very strange at first, and I had the same reaction as you, but it's actually quite nice. (I say that a…

You mean the language is case insensitive and drops _'s or something? Doesn't that break searchability with command line tools (or make for much more complicated regexes)?

Or do you just mean use a mixture just like you could in most other languages?

Re: Nim 2.0 thoughts

#103
post #61
post #21

Earlier quoted context omitted.

Then you end up with an ecosystem with mixed conventions. Not good IMO.

Actually, in Nim "functionName", "function_name" and "functionname" are equivalent and interchangeable

So one needs to grep 3 times instead of once in a code-base. Why did the authors chose this abominable convention ? It makes maintenance a nightmare.

Re: Nim 2.0 thoughts

#104

Earlier quoted context omitted.

Nim has a garbage-collector right? In that case I don't see how you can compare Nim and Rust. The Go comparison makes more sense.

It has a garbage collector by default, though it can be disabled (--gc:none) and then you can manage memory manually. In the future, Nim's default memory management will use reference counting with destructors and move semantics inspired by Rust and C++. https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc... https://nim-lang.org/docs/destructors.html https://nim-lang.org/docs/nimc.html

This is really cool. I really want a language that has GC, but lets me be explicit about memory usage as well / leverage move semantics to optimize. I use Rust, and I suspect I'll always have it as a driver, but I wouldn't mind another higher level language to take the place of Python, which I use for prototyping.

Re: Nim 2.0 thoughts

#105

Earlier quoted context omitted.

I started using it for parsing heavy files, just for the speed. Slowly I replaced Python with Nim for almost everything, even when it doesn't make much sense (e.g. for controlling Selenium), and only use Python when I need graphics (Matplotlib) or some other libraries that I cannot replace. IMO the main case is when you need C speed but you don't want to code in C.

Nim as a replacement for Python makes sense to me. We often hear that many Python developers went on to choose Go when needing more performance, but Nim feels like an easier move.

Nim not only faster than Go but have a very similar syntax to python. It make more sense for Python developers to use Nim when need more speed instead of Go.

Re: Nim 2.0 thoughts

#106

Earlier quoted context omitted.

What's the main use case of Nim, would you say? Is it good for personal project/automation, for desktop or web apps? Etc.

I started using it for parsing heavy files, just for the speed. Slowly I replaced Python with Nim for almost everything, even when it doesn't make much sense (e.g. for controlling Selenium), and only use Python when I need graphics (Matplotlib) or some other libraries that I cannot replace. IMO the main case is when you need C speed but you don't want to code in C.

This sounds cool, I would be very interested if you had any public code on how to control Selenium using Nim.

Re: Nim 2.0 thoughts

#107
post #106

Earlier quoted context omitted.

I started using it for parsing heavy files, just for the speed. Slowly I replaced Python with Nim for almost everything, even when it doesn't make much sense (e.g. for controlling Selenium), and only use Python when I need graphics (Matplotlib) or some other libraries that I cannot replace. IMO the main case is when you need C speed but you don't want to code in C.

This sounds cool, I would be very interested if you had any public code on how to control Selenium using Nim.

I just use https://github.com/halonium/halonium, to automate some simple tasks. My code is less interesting than the "examples" folder of that repo.

Re: Nim 2.0 thoughts

#108
post #35

I started using Nim recently and have been very impressed. It feels like a better Rust than Rust, and a better Go than Go. Why doesn’t Nim get more attention?

I think one reason is that there's no big corporation behind it, for Rust it was Mozilla and now the members of the Rust Foundation, for Go it is Google. But I totally agree, Nim is an awesome language and definitely deserves more attention!

Didn't python start this way 25ish years ago? It then has slowly and steadily gained developers. Nim might also be there in another 15 years.

Re: Nim 2.0 thoughts

#109

Earlier quoted context omitted.

What made me pick Go over Nim is a bigger standard library. For my use Nim is missing a good http server package/module and templating. If those two things had been present I would pick Nim over Go, it’s just a nice language for some like me, who have mostly done Python. I’m not sure if this was a bug in a third party module, but I also struggled a little with unicode support.

Templating as in Jinja? I'm using Karax ( https://github.com/karaxnim/karax#server-side-html-rendering ) and it's awesome.

That’s nothing like Jinja, it’s more like React. I just want text templating and not a virtual dom and I don’t want to build my HTML in Nim.

Re: Nim 2.0 thoughts

#110
post #94

Earlier quoted context omitted.

What made me pick Go over Nim is a bigger standard library. For my use Nim is missing a good http server package/module and templating. If those two things had been present I would pick Nim over Go, it’s just a nice language for some like me, who have mostly done Python. I’m not sure if this was a bug in a third party module, but I also struggled a little with unicode support.

Something like: https://nim-lang.org/docs/asynchttpserver.html https://github.com/zendbit/nim.zfblast

Zfblast seems new, so maybe. The asynchttpserver does work, but it’s simply not as good or complete as the one in Go.

It might just be to low level.

Post reply on HN