I don't have answers. I have no problem with the Option[T] method used by Nim
myself.
But, has a whole, most languages have a hard time differentiating between four
completely different concepts:
`nil`: memory is not allocated; a C term.
`null`: per SQL and other definitions, this means "unknown".
`empty`: means "nothing", a lack of information, or zero. Depends on the type.
`none`: means there is no such thing as a such a value.
An easy way to demonstrate them is with JSON. The array "abc" in the following:
`null`:
{
"foo": 1,
"abc": null,
"bar": 3
}
Run
`empty`:
{
"foo": 1,
"abc": [],
"bar": 3
}
Run
`none`:
{
"foo": 1,
"bar": 3
}
Run
A `nil` does not apply to JSON. That is more of a pointer thing. Though, in
some languages, `nil` and `null` are interchangeable; but not all of them.
Philosophically, I've been thinking about this for the last few years. No
answers jump out yet, but I've been thinking about it.