Live data from Hacker News

Nim 2.0

nim-lang.org

71–80 of 213 posts

Re: Nim 2.0

#71
post #20

Earlier quoted context omitted.

Nim's should probably be redone with mummy (multi-threaded) and chronos (async single-threaded) for a better showing: https://github.com/guzba/mummy https://github.com/status-im/nim-chronos

Why does the stdlib implementation do so badly in the first place?

Too much string copying iirc. It was written a while ago.

Hopefully it'll get updated/replaced some time, but there's plenty of faster 3rd party ones already.

Re: Nim 2.0

#72

nim is a better python(syntax wise) that compiles to c(or c++,js,etc but c is the default) with GC turned on by default. I have always been wanting to use it outside of what my job needs(c/c++/python). I hope some big players adopt Nim to make it one of the mainstream language.

Reddit was hiring for Nim positions. So demand is growing. New languages have easier time being adopted at startups which grow into big players eventually.

Re: Nim 2.0

#73

What are some noteworthy projects or libraries written in Nim?

Not sure if it counts as noteworthy, but I'm submitting this comment via my TUI web browser that I've been writing in Nim.

https://git.sr.ht/~bptato/chawan

Also, there exists another Nim web browser project; from what I can tell, it's in somewhat earlier stages of development.

https://github.com/xTrayambak/ferus

Re: Nim 2.0

#74
Nim is really very nice language to write software in. Ship fast, enjoy the ride, produce very performant software. Unfortunately it still in my experience has some sharp edges: juggling C/C++ compilers and options, very poor error messages, very situational libraries that only work on some settings and systems. Given the small community, tho, I can't really fault them for it. The VS Code integration works very well in my experience, rarely crashing.

Re: Nim 2.0

#75

If someone at Manning Publications is reading this, it would be great to have a book on the newer Nim version, but please consider using a different typesetting with more readable fonts. I purchased the great book by Dominik Picheta, but am forced to use the .pdf because the dead tree version uses thin fonts that I find extremely hard to read even with the right pair of glasses. Font components (arms, lines, stems, e…

Not with Manning, but if you have a login you can submit this sort of request via their contact page:

https://www.manning.com/contact

Re: Nim 2.0

#76

Could be a fun python alternative Questions: - value/object semantic: i peeked at some code, and i can't tell what is a value, and what is a reference type, is everything heap allocated? - tooling: what's the state of their language server? does it work with all of their language features? - debugging: does gdb/lldb understand nim's types and slices? And finally: is a no-gc mode available? I'll play with it later tod…

Reference semantics are part of the type.

So "var i: int" is value, "var i: ref int" is a heap allocated reference that's deterministically managed like a borrow checked smart pointer, eliding reference counting if possible.

You can turn off GC or use a different GC, but some of the stdlib uses them, so you'd need to avoid those or write/use alternatives.

Let me say though, the GC is realtime capable and not stop the world. It's not like Java, it's not far off Rust without the hassle.

Re: Nim 2.0

#77
post #36

Earlier quoted context omitted.

And which language did you enjoy coding in the most? Yeah, a subjective question :-). (Edit: Missed the auto-generated part, so maybe you don't have an opinion on experience regarding this?)

I think actually Odin, although I was surprised by that (being more of a Zig fan). Odin has some neat convenience features which are nice for higher level code, while Zig can be a lot more 'draconian' by enforcing correctness even at the cost of some "line noise" (but I guess both languages are still in flux, so that might change). As for Nim I enjoyed it initially (because of the Python vibes I guess) but the automa…

This might sound strange, but in my opinion Odin is a Pascal variant with a C like syntax.

Re: Nim 2.0

#78

Earlier quoted context omitted.

Zig doesn’t seem to have an implementation for the TechEmpower Benchmarks but Nim does: https://www.techempower.com/benchmarks/#section=data-r21&l=y...

And I'm surprised by how terribly it ranks – basically dead last against everything, even the Python frameworks, which is impressive.

httpbeast[1] reached #6 at one point, but I think the author is busy with other things nowadays.

https://www.techempower.com/benchmarks/#section=data-r18&hw=...

[1] https://github.com/dom96/httpbeast

Re: Nim 2.0

#79
post #4

Anyone have working experience with Nim and Zig? I'd love to hear how they are similar and contrast. I'd also would like to see some idiomatic web server benchmarks between the two (now with Nim v2).

I've done green-field work with both Nim and Zig.

There were loads of specific differences, but if I could characterize both languages in a simple way:

- Nim seems to emphasize being a swiss army knife in the way that Python is, except as a compiled language.

- Zig is a much more focused language that tries to hit a certain specific niche - being a successor and replacement for C - and hits that mark spectacularly.

I think language preference comes down to what your personal needs and wants out of a new language that isn't being served by whatever you're using currently. I personally landed in the "Zig" camp because the way it approaches its ambition of being a C successor is intriguing, but I could see why other people might land on Nim.

Re: Nim 2.0

#80
post #15
post #8

Earlier quoted context omitted.

> “It prefers the stack so strongly that dynamic data structures (sequences and tables, basically its lists and dictionaries) are pointers on the stack to heap data, where the lifetime is managed by the stack frame.” Isn’t that the same as a C++ vector or map on stack? They allocate internally as needed, and the whole container is destroyed when it goes out of scope.

Agreed, only being able to put pointers on the stack, no data, would make me think it "prefers the heap".

Types are stack allocated by default.

"var data: MyObject" is on the stack. "var arr: array[1000, MyObject]" is allocated on the stack sequentially.

Only dynamic seq or ref types use the heap by default.

Post reply on HN