[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] extension request
From: |
Andreas Fischlin |
Subject: |
Re: [Gm2] extension request |
Date: |
Mon, 27 Sep 2010 07:44:50 +0200 |
No, this does not make sense, since it would complicate the implementation of a
compiler considerably. Modula-2 assumes that ORD(MIN(EnumType)) = 0 and that
ORD(INC(et)) - ORD(et) = 1 when variable et is of type EnumType etc. Moreover,
CASE statements can become very difficult to implement either. I suggest you
use constants for your purpose.
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 27/Sep/2010, at 00:55 , Martin Kalbfuss wrote:
> Hi.
>
> While working on my SDL wrapper, I had a problem with enumerations and
> sets.
>
> The save enumeration type of modula is not as flexible as the C/C++
> enumeration type. You cannot explicitly set numerical values for the
> flags. That's no problem as long as you work with modula only. But if
> you have a C/C++ enumeration like
>
> typedef enum
> {
> VALUE_1 = 0,
> VALUE_2 = 60;
>
> }AN_ENUM;
>
> You get in trouble. You have to use plain numbers in your definition
> modules and loose the savety of the Modula types and have a C-Like
> interface. Not nice. Would it be possible to allow to set the values for
> modula enumerations explicitly?
>
> Like
>
> TYPE Key = (..., K_AT = 64, K_LEFTBRACKET = 91, ...);
>
> Thanks,
>
> Martin
>
>
> _______________________________________________
> gm2 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gm2