[M3devel] range analysis?

Rodney M. Bates rodney_bates at lcwb.coop
Wed May 25 17:55:11 CEST 2011



On 05/24/2011 03:21 PM, Mika Nystrom wrote:
> "Rodney M. Bates" writes:
> ...
>>
>> My first thought was that this argument is no more or less applicable to
>> a procedure type containing a formal of empty type than to a record
>> type containing a field (which is currently defined as a variable)
>> of empty type.  Both are just types constructed from other type(s),
>> to be maybe instantiated later.  In the case of the record, we now
>> disallow the type to be constructed.  Your proposal would inconsistently
>> allow the procedure type to be constructed but complain when an
>> attempt is made to instantiate it (i.e., call it) later.
>>
>> My second thought was that a procedure type with empty-typed formal
>> is not an empty type, because it contains the perfectly legitimate
>> value NIL, which of course, you can't call anyway, thus avoiding the
>> issue of instantiating the formal.  This is an essential difference
>> that would justify doing it differently for records and procedures.
>>
>
> By this logic, shoudln't you also allow such types to be fields
> in OBJECT types?

Yes. But neither the language nor the compiler allow this.  The
compiler gives no error on subsequent attempt to allocate such an object,
but this is probably just secondary.

What about REF RECORD types?

REF EmptyType is OK, and the compiler allows it to be defined
but not allocated.  But the only ways right now to get an empty
type are an empty enumeration, empty subrange, or array of
empty-typed elements.  Try to construct a record with an
empty-typed field and the type definition fails.

I am doing more compiler experiments and language reading.
It looks like we have some inconsistencies.

>
>      Mika
>



More information about the M3devel mailing list