Live data from Hacker News

Nim 2.0 thoughts

forum.nim-lang.org

61–70 of 150 posts

Re: Nim 2.0 thoughts

#61
post #21

Earlier quoted context omitted.

Even though it's not according to the styleguide, you can just use snake_case whenever and wherever you want, consumers of your libraries or other way around will never notice!

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

Re: Nim 2.0 thoughts

#62
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?

How's Nim faring with regards to easy programming for multicores? (I think that's the main selling point of Go).

First, I like that you said "multicores" and not "multithreads". Default-sharing of all memory is overrated. Sometimes it is useful/necessary, but people reach for threads too readily, IMO.

For multiprocessing (like Python's module of that name), you can roll your own little system in probably 100 lines of code or use something like this [1] with an example program [2]. For me, that toy program runs 1.5-2x faster than ripgrep on the same (admittedly limited) problem on Linux. { I suspect this perf diff is due to mmap IO being faster than syscall IO due to SIMD register use as discussed here [3], but this deserves deeper investigation than I have time for right now. If my hunch is right, that may constitute further argumentative support for not leaping to threads even if the programming language "makes them 'easy'", though. }

As for threads/parallelism with shared memory in Nim..Honestly, there is probably too much to recap. Weave [4] would be a good place to start reading, though, or searching the Nim Forum.

  [1] https://github.com/c-blake/cligen/blob/master/cligen/procpool.nim

  [2] https://github.com/c-blake/cligen/blob/master/examples/grl.nim

  [3] https://news.ycombinator.com/item?id=24842648

  [4] https://github.com/mratsim/weave

Re: Nim 2.0 thoughts

#63
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?

How is the compiler, speed wise? One thing I really like about Go and really don't like about Rust are their relative compiler speeds. I think it makes a big different for the language and Nim has a chance to get this right as they didn't make the mistake of using LLVM and it's bad compiler UX.

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

Re: Nim 2.0 thoughts

#64
post #10

Earlier quoted context omitted.

I love python as well, and I literally just started exploring Nim yesterday, so this is very timely. The one thing that stuck out to me like a sore thumb is the camelCase convention. I know it's a minor thing (and a personal preference), but I'm a bit biased against languages that use camelCase (Java, JavaScript, etc). There's something uneasy about it IMHO.

Nim is partially case-insensitive: https://nim-lang.github.io/Nim/manual.html#lexical-analysis-... my_foo, myfoo, and myFoo are interchangeable. MyFoo is different because the first letter is capitalized. If it's not clear, what I mean is that if you've imported a module that exports myFoo, you can refer to it in your code as my_foo, if you prefer. Some people love this aspect of Nim, others loathe it. I don't have s…

> my_foo, myfoo, and myFoo are interchangeable. MyFoo is different because the first letter is capitalized.

God, that's horrible.

Re: Nim 2.0 thoughts

#65
post #42

Man nim is such a cool language it just need some more community and better docs to get some hype.

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

When you want the performance of a low level compiled language with the ease of use and powerful constructs of a high level language - and don't want all the bondage and discipline of rust.

Re: Nim 2.0 thoughts

#66
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?

It may be better than Go but I don't see how it is comparable to Rust. Rust's biggest selling point is compilation-checked memory and thread safety guarantee without garbage collection. Nim instead uses a garbage collector, or a reference counter similar (but deterministic) to Swift which can cause memory leaks, or manual memory management.

Nim is getting very close to Rust in terms of safety (but without the verbose ownership management)

https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...

https://nim-lang.org/blog/2020/12/08/introducing-orc.html

Re: Nim 2.0 thoughts

#67
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?

It may be better than Go but I don't see how it is comparable to Rust. Rust's biggest selling point is compilation-checked memory and thread safety guarantee without garbage collection. Nim instead uses a garbage collector, or a reference counter similar (but deterministic) to Swift which can cause memory leaks, or manual memory management.

It was discussed recently: https://forum.nim-lang.org/t/7905

> to Swift which can cause memory leaks

The Nim compiler can detect cycles and warn you. And --gc:orc collects them successfully at runtime. Orc is going to be the default.

Re: Nim 2.0 thoughts

#68
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?

It would be interesting to see a compilation of all of the times people asked that question. Like literally every time anything about Nim is posted, someone asks that.

Re: Nim 2.0 thoughts

#69
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?

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.

Re: Nim 2.0 thoughts

#70
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?

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.

You can avoid it if you want. That is what a lot of the recent changes are about.
Post reply on HN