[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] Re: enumerated types and import rules
From: |
Gaius Mulley |
Subject: |
[Gm2] Re: enumerated types and import rules |
Date: |
Thu, 15 May 2003 22:23:55 +0100 |
Hi,
hmm, upon further analysis, it appears (to me) that according to the
Interim Version of 4th Working Draft Modula-2 standard that one _must_
explicitly import an enumerated type to access the enumeration
elements. So the following code should not compile after all. [See
section 6.1.6.5 Closure]. Or have I misunderstood something?
Can anyone confirm that this is the same with the most up to date
standard. I will now order my copy :-)
It would also be good to confirm this with an ISO complient compiler.
Thanks,
Gaius
MODULE impf ;
IMPORT impb ;
CONST
start = impb.red ; (* should give an error? *)
end = impb.green ; (* should give an error? *)
VAR
a: ARRAY [start..end] OF CARDINAL ;
b: impb.C ; (* this should be ok *)
BEGIN
END impf.
-----------
DEFINITION MODULE impb ;
IMPORT impc ;
TYPE
C = impc.C ;
END impb.
-----------
DEFINITION MODULE impc ;
TYPE
C = (red, blue, green) ;
END impc.
- [Gm2] Re: enumerated types and import rules,
Gaius Mulley <=