3 ms·
Depending upon language, and what you're using to hold the array, inheritance. A 'NotEmpty a' is just a subclass of a potentially empty 'a'. You also get the
by bcrosby95 4y ago
Depending upon language, and what you're using to hold the array, inheritance.
A 'NotEmpty a' is just a subclass of a potentially empty 'a'. You also get the desirable behavior, in this scenario, of automatic upcasting of a 'NotEmpty a' into a regular old 'a'.
- secdeal 4y agoNot quite, 'a' is the type of the elements 'NonEmpty a' contains. It is rather the subclass of some kind of 'Iterable a'.