3 ms·
> Null is only allowed in unsafe code. That’s clearly not the case, as the exact code in the post prints ‘&nil’ in current V master, and if you add a dereferen
by anderskaseorg 4y ago
> Null is only allowed in unsafe code.
That’s clearly not the case, as the exact code in the post prints ‘&nil’ in current V master, and if you add a dereference you get a segfault (which someone else just filed as https://github.com/vlang/v/issues/14911 https://github.com/vlang/v/issues/14911).
> Overwriting of len was never fixed, because it was never an issue in the first place. The author made it up.
The home page claims the language has “no null (allowed in unsafe code)”. println(*[]&int{len: 1}[0]) is not marked unsafe, yet it still segfaults by dereferencing a null pointer. Can you explain why you say this was never an issue?
(I’ve filed this as https://github.com/vlang/v/issues/14914 https://github.com/vlang/v/issues/14914. A related issue in maps was filed a year ago: https://github.com/vlang/v/issues/10837 https://github.com/vlang/v/issues/10837.)
> It's always worked like in Go.
Go is not a language that claims to have no null.