gm2
[Top][All Lists]
Advanced

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

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


From: Gaius Mulley
Subject: Re: [Gm2] Fwd: CASE: gm2-4.1.2 of 2011-11-08 bug (or possibly philosophical difference)
Date: Sun, 13 Nov 2011 11:45:18 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Gary E Rudy <address@hidden> writes:

> At 06:10 AM 11/11/2011, you wrote:
>
>>ItemType = RECORD CASE : INTEGER OF
>>1: ....
>>2: ....
>>     END(*CASE*); END(*RECORD*)
>
> This checking is very easy to bypass with:
>
> ItemType = RECORD CASE : INTEGER OF
> 1: ....
> 2: ....
> ELSE (* Do nothing, I don't care! *)
>     END(*CASE*); END(*RECORD*)
>
> As long as its an option I certainly don't see any reason not to have
> it available.
>
> I found this very annoying when I first moved to a more ISO aware
> compiler, but I eventually found it at least somewhat useful. The
> compiler I use (Stonybrook) makes it very easy to turn this checking
> on and off in the code on a case by case basis (no pun intended
> :). Eventually I just started adding the empty ELSE clause where I
> didn't want it, though, very simple. If you do add the checking, do
> make sure it takes that into account!
>
> Obviously it's original purpose, and where it CAN be somewhat useful
> is with enumerated types to make sure you don't simply omit one by
> mistake, or forget to adjust all of your code when a new value is
> added to the type later on.
>
> --Foo

Hi Gary,

yes I think this is why I didn't skip the test in gm2 1.0.  But I
concede that in huge legacy code bases it could be painful to add ELSE
to each variant record.  As you say it is also easy to disable the check
anyway.

My further question to the list is should gm2 warn or give errors if the
case variant values overlap (with -fpim)?

regards,
Gaius



reply via email to

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