gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] CASE: gm2-4.1.2 of 2011-11-08 bug (or possibly philosophical d


From: Fischlin Andreas
Subject: Re: [Gm2] CASE: gm2-4.1.2 of 2011-11-08 bug (or possibly philosophical difference)
Date: Sat, 12 Nov 2011 10:35:47 +0000

No, don't make things unnecessary complicated. I see little risk in leaving 
this simple by not checking.

As Niklaus Wirth said many times: A standard is then agreed on, when it is no 
more of much interest. Similar things can be said about ISO for Modula-2. The 
compiler should merely make sure type consistency between the case selectors 
and the given type and compute memory allocation needs of the type according to 
the "worst case" case variant.

Regards,
Andreas



ETH Zurich
Prof. Dr. Andreas Fischlin
Systems Ecology - Institute of Integrative Biology
CHN E 21.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

address@hidden
www.sysecol.ethz.ch

+41 44 633-6090 phone
+41 44 633-1136 fax
+41 79 221-4657 mobile

             Make it as simple as possible, but distrust it!
________________________________________________________________________



On 11/11/2011, at 18:58 , Gaius Mulley wrote:

> john o goyo <address@hidden> writes:
> 
>> As we all know, PIM allows missing values in CASE statements but ISO
>> does not.  At present, gm2 enforces the ISO restriction regardless of
>> which PIM is specified.  (A simple example may be found below.)
>> 
>> What should gm2 do?  (The problem arises, of course, in compiling
>> existing code.)
>> 
>> john
>> 
>> ==============================
>> MODULE Test;
>> 
>> TYPE
>>  Choice = (colour, size, weight);
>>  ItemType = RECORD
>>        CASE c :Choice OF
>>          colour: col :CHAR;
>>         |size:   s :CARDINAL;
>>        (*
>>         * PIM allows missing values but ISO does not.
>>         *)
>>        END (*CASE*);
>>  END (*ItemType*);
>> 
>> VAR
>>  item :ItemType;
>> 
>> BEGIN
>>  item.col := 'R';
>> END Test.
>> ==============================
> 
> Hi John,
> 
> thanks for the bug report - indeed gm2 should not insist of each value
> specified inside the variant record (for pim).  I'll relax the checking
> for -fpim and friends.  I think it might be useful to introduce a new
> option to switch this checking on/off then we get the best of both (if
> desired),
> 
> regards,
> Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]