Re:Parse, Don't Validate (2019)
by bcrosby95 on Tuesday March 07, 2023 @12:22PM
(#35058114)
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'.
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'.