-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
I'd like to suggest changing the isnull::Bool
field of Nullable
to a hasvalue::Bool
field with the opposite meaning. Indeed, all languages and formats I could find use this convention. Following the most common convention is generally a good idea, and it's particularly useful when creating NullableArrays
from binary formats like Feather.
Of course, this would be a breaking change, but it would only affect code which does not use the public isnull()
method. Since that method is a simple accessor to the eponymous field, there's no reason to access the field directly. Potential breakage would easily be fixed before 0.6 is released by changing x.isnull
to isnull(x)
, which works since Julia 0.4.
Here's a short survey of what other software does in that regard:
- In C#, the
Nullable
type has anHasValue
field. - In Scala, the
Option
type has anisDefined
method. - In Go, null types have a
Valid
field. - In SQLite, a
NULL
is marked via serial type0
(equivalent tofalse
in most languages). - In PostgreSQL, in Feather and in Pandas 2, the null bitmask uses a
0
bit (again equivalent tofalse
in most languages) to denote anull
.