Live data from Hacker News

Nim in 2020: A Short Recap

nim-lang.org

31–40 of 121 posts

Re: Nim in 2020: A Short Recap

#31
post #4

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

Most of them actually, it is only lacking in manpower.

It provides the productivity of having a GC around (no need with coding for borrow checker patterns), you can still go as low level as you want, including writing GC free code, and is very fast compiling code.

Re: Nim in 2020: A Short Recap

#32

Earlier quoted context omitted.

Nim compiles to js (as well as c and c++)

How much of C and the standard library does it use? Like, if I wanted to make my own C compiler, how much would I have to implement for it to be usable with Nim-generated code? Does it use a fairly constrained subset or does it use a lot of C and the standard library? I imagine the latter but just curious.

Doesn't depend much on the standard library -- almost not at all, and usually behind flag (e.g., if you don't -d:useMalloc , nim will not us malloc).

I think it's no longer maintained, but there's a kernel that boots on metal written in Nim. Furthermore, people are running Nim on ESP32, Nintendo Switch, JS (Browser, Node), iOS, Android and more; From that alone its clear that the C library can't be a significant dependency.

(And ... just about any C compiler around, including GCC, LLVM, TCC, MS C, Intel C, Zig C are supported when using C as a backend).

Re: Nim in 2020: A Short Recap

#33
post #12

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

So I used to totally agree with you... then I used Nim in anger. Honestly the whole white space thing barely even registered in the end for me!

Re: Nim in 2020: A Short Recap

#34

Earlier quoted context omitted.

Nim compiles to js (as well as c and c++)

How much of C and the standard library does it use? Like, if I wanted to make my own C compiler, how much would I have to implement for it to be usable with Nim-generated code? Does it use a fairly constrained subset or does it use a lot of C and the standard library? I imagine the latter but just curious.

It is just a convenience, Objective-C and C++ also generated code like that on the early days.

Re: Nim in 2020: A Short Recap

#36
post #23
post #12

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

This might have been excused if they didn't also forbid tabs unless you use a hack ( https://github.com/nim-lang/Nim/wiki/Whitespace-FAQ#tabs-vs-... ), was interested in learning until I found this out

what's wrong with setting tabs to 4 spaces?

Re: Nim in 2020: A Short Recap

#37
post #16
post #12

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

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.

Best of all, they also provided that required punch in the Java and .NET design room to force them to revisit not having a proper AOT toolchain available since version 1.0.

Re: Nim in 2020: A Short Recap

#38
post #27

Earlier quoted context omitted.

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

Nim looks Pytonish (and has some Python-inspired syntax), but it is very much NOT Python. People coming from Python that expect a "compiled, faster" Python often find a compiled, faster language but have very weird concepts expecting that language to behave like Python though it isn't.

When I started learning Nim, I did not really expect anything, but time and again I caught myself thinking, ‘This is so much like Python!’ Eventually I lost interest because I do not need a faster Python that is not Python, and I didn’t find much else to be enthusiastic about.

Re: Nim in 2020: A Short Recap

#39
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 think Ruby's do/end is most readable variant.

Python using whitespace doesn't allow me to mess up and have my formatter autoformat it. Js and others with {} have way too many symbols flying around for easy parsing.

Thats why I really like crystal! Do/end, low level, elegant. Wish the devs would focus more on wasm and other features that would put it more in the spotlight.

Re: Nim in 2020: A Short Recap

#40
post #16
post #12

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

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 easier to share state between threads. At least compared to golang, nim hasn't been a smooth experience yet when it comes to threads.

Anyways, I'm just voicing my personal gripe with the use of whitespace-sensitive syntax. Nim is a overall a good language to use.

Post reply on HN