4 ms·
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, i
by WhereIsTheTruth 3y ago
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 today, it's always been in my todo list of languages to try, now is the perfect time
- janAkali 3y ago1. Nim uses 'var' modifier to pass by reference, e.g. "proc (n: var int)...", default behaviour is pass by value. And there're also raw pointers and references (safe pointers). >is a no-gc mode available? You can disable gc, but most of standard library depends on it. But in Nim 2.0 there's finally support for ARC and ORC (ARC + cycle collector).
- msk-lywenn 3y agoI've been searching and can't find it: A in ARC is for automatic, what does the O stand for?
- lambertsimnel 3y agoI assumed the O was for "optimised", but apparently it stands for "cycle": https://nim-lang.org/blog/2020/12/08/introducing-orc.html https://nim-lang.org/blog/2020/12/08/introducing-orc.html
- dinHeld 3y agoO is a visual pun because it adds a cycle collector to ARC.
- ElegantBeef 3y ago> default behaviour is pass by value Is not exactly true, smaller than 24 bytes is passed by value, the compiler optimizes larger calls and passes by reference implicitly.
- arc619 3y agoReference 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.
- xigoi 3y ago> i can't tell what is a value If a type is declared with 'ref', it's a reference type. Otherwise, it's a value type.