Closed jpivarski closed 1 year ago
Is there a conceptual or application-wise difference between Unset
and built-in singleton type nothing::Nothing
?
In Awkward, IndexedOptionArray
satisfies both is_indexed
and is_option
, which I'm implementing here with abstract types (isa
-checkable interfaces; no data or constructors). But it seems that multiple inheritance of abstract types is not yet a feature of the language (JuliaLang/julia#5).
So I'll just ignore is_indexed
and only implement is_option
, so that the inheritance is strictly a tree. It's a minor point; just noting this for the record.
Is there a conceptual or application-wise difference between
Unset
and built-in singleton typenothing::Nothing
?
Some of the arguments for copy
could legitimately be nothing::Nothing
. Let me think of an example... Actually, no! RecordArray.fields
would have been the example (in Python, fields=None
means it's a tuple with unnamed fields, rather than a record with named fields), but in Julia, I'm using a NamedTuple
to provide both field names and contents. On the one hand, that means that there happen to be no Content
subclass arguments that could take a None
/nothing
value, and on the other hand, it means that I'm not done with RecordArray
because I'll need to implement tuples as a separate class, based on Tuple
, rather than NamedTuple
.
But even if I switch all of the Unset
sentinels over to Nothing
, there's a (small) chance that in the future, a parameter will be added that can legitimately be nothing
, and then it would be hard to switch all the Nothings
back into Unset
. It would break backward compatibility.
The reason is completely analogous to why these methods in Python have UNSET
defaults, rather than None
:
Congrats!! that was unbelievably fast
Thanks!
Some things will be easier to apply, now that all of the node types exist.
LeafType
)LeafType
)ListType
)ListType
)ListType
)OptionType
)OptionType
)OptionType
)OptionType
)AwkwardArray.Record
AwkwardArray.Tuple