News for hackers. Stuff that matters.
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'.

Re:Parse, Don't Validate (2019) by secdeal on Tuesday March 07, 2023 @02:38PM (#35060098)
Not quite, 'a' is the type of the elements 'NonEmpty a' contains.

It is rather the subclass of some kind of 'Iterable a'.