3 ms·
I have no objection to Vlang having "null", after all many languages have it. My problem is the outright lies on the front page. Someone who is looking into Vla
by theamk 1y ago
I have no objection to Vlang having "null", after all many languages have it. My problem is the outright lies on the front page. Someone who is looking into Vlang might actually believe what's written on the front page, spend some time learning language, and come up disappointed. So I am saving them some time by warning them in advance.
And no, if you that using null is V is "improper", this still means V has nulls. If the it will not have nulls "in the future", it means it still has nulls today. The front page does not mention any "future" part. And mentioning that you cannot assign it to any variables outside of "unsafe" is outright wrong.. It works just fine, it's just spelled differently (as "voidptr(0)"). Try it yourself in playground:
ptr := &int(voidptr(0)); println(*ptr);
The thing is, there are plenty of languages without "null" - Rust of course, but also much more "conventional" languages like Kotlin and Swift. So we know what language-without-nulls looks like - there are nullable and non-nullable pointer-things (they may be called using different terms), they are distinct types, and you need a special ceremony to access nullable pointer-things where you specify what to do if the value is null/missing. Vlang does not have anything like that, and it's trivially easy to get the null pointer (either intentionally or from trivial programming error) in safe code.