|
|
|
|
|
by gmfawcett
2186 days ago
|
|
Fair point. I should mention that I'm not a Nim expert, and am not defending its design. It's true that 'nil' appears in Nim under both of its pointer types (GC traced "references" and untraced "pointers") -- which is unlike, say, Rust's safe references vs. unsafe (nullable) pointers. So 'nil' is not simply a systems level construct; otherwise you might expect Nim to have nillable pointers, but not nillable references. You need nil/null when doing systems work -- and Nim is capable of that -- but I don't know the rationale for allowing 'nil' in higher level language features. |
|
Nim interests me but this nil business seems questionable to me.
Just found this comment from the language creator,
https://github.com/nim-lang/Nim/issues/6638#issuecomment-487...
"We need the nil state to disarm pointers but that only means these can be nil and so would require a nil check before deref. Doesn't seem to be too hard nor too cumbersome."
Seems a bit dismissive to me