I'm trying to figure out how (and under what circumstances) one would use
Nullable. That is, it seems that it might be valuable when you don't know
whether the value/object exists (sort of like Python's None, I guess), but
then something like "Nullable(3) == 3" returns false, and that sort of
messes up how I'm thinking about it.
The code I'd imagine would be useful would be something like
function foo(x::Int, y=Nullable{Int}()) # that is, y defaults to python's
"None" but is restricted to Int
if !isnull(y)
return x+y # x + get(y) works, but why must we invoke another
method to get the value?
else
return 2x
end
end
I'm left wondering why it wasn't reasonable to allow y to return get(y) if
not null, else raise a NullException, and the conclusion I'm coming to is
that I don't understand the concept of Nullable yet. Any pointers?