4 ms·
> It will be interesting to see exactly how nothing and missing play out in-practice. I feel like if all things go well, then in most circumstances operating wi
by twic 8y ago
> It will be interesting to see exactly how nothing and missing play out in-practice. I feel like if all things go well, then in most circumstances operating with a missing should return a missing (i.e. properation), and operating with a nothing should throw an error (Much like a NullReferenceError).
We all know that having a null value in your language is a mistake, but i have to admit that it had not occurred to me that the fix was to have two null values.
- masklinn 8y ago> We all know that having a null value in your language is a mistake, but i have to admit that it had not occurred to me that the fix was to have two null values. Javascript is even better as it has 3 (null, undefined and NaN, and while NaN is available in most every language it is pretty common in JS as its conversion APIs tend to return NaN instead of error).
- zimablue 8y agoThe root of "null is a mistake" isn't that null is a mistake, it's that it's a mistake to allow null into a type system in such a way that it can cause non-compile-time type errors. So Julia is typed ( I think) but it's not a mistake in any way to have null in a dynamic language by this argument. Null is a thing and if you don't have it you reinvent it, it's the typesystem breaking that's the problem, maybe monads effectively have nulls it's just that they then get protected by the typesystem.
- one-more-minute 8y agoRight, Julia is dynamically but nonetheless very strongly typed. If you write `x::String` then x is a string; you won't ever get a surprise null pointer error from that code, and `nothing` doesn't tend to propagate far from where it appeared (the core problem in languages like Java). In future we'll likely have shortcuts for `T?` as `Union{T,Nothing}`; effectively a dynamic version of optional/maybe types, as in Swift and others.