[M3devel] null type?

Darko darko at darko.org
Wed Apr 24 14:02:18 CEST 2013


It does come from the idea of the type lattice, but I think it's an important abstraction when thinking about types in any language. In my mind the "absurdity" is the idea that there can be some type that is a subtype of all things. Of course there is nothing that can be that, but even nothing has to be represented as some thing. In other languages a value of this bottom type is called "failure", which I think makes it clearer. "Null" is often interpreted as "don't know or don't care", which leadings to people thinking about the bottom type instead as the top type, so we have people assuming the type of NIL is REFANY.


On Apr 23, 2013, at 8:09 PM, Hendrik Boom wrote:

> On Mon, Apr 22, 2013 at 04:29:06PM -0700, Darko Volaric wrote:
>> There's another aspect of the NULL type which should be considered here.
>> NULL is the complement of REFANY. Just as REFANY is the ultimate ancestor
>> of all reference types, NULL is the ultimate descendant of
>> all reference types. As a result any variable of a reference type can be
>> assigned NIL. Because of its unusual position, NIL is the only member of
>> type NULL, since no other value makes sense (which is why it's sometimes
>> called the "absurd" type).
> 
> I think that terminology comes from the type lattice, and perhaps also 
> from the propositions as types formalism.  The type that is properly 
> "absurd" is the type with no elements at all, corresponding to the empty 
> set.  A functino returning a value of this type can never return, 
> because there are no values of that type.
> 
> But since Modula 3 (as many other languages) has no truly empty type, 
> the bottom of the type lattice is NULL, and I suppose its kind of 
> plausible that it get called "absurd" for that reason.
> 
> -- hendrik




More information about the M3devel mailing list