[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] enumerated types and import rules
From: |
Gaius Mulley |
Subject: |
[Gm2] enumerated types and import rules |
Date: |
Thu, 15 May 2003 14:45:58 +0100 |
Hi,
I have a question about the rules of importing enumerated types
and types derived from enumerated types.
Consider these modules:
MODULE impf ;
IMPORT impb ;
CONST
start = impb.red ;
end = impb.green ;
VAR
a: ARRAY [start..end] OF CARDINAL ;
b: impb.C ;
BEGIN
END impf.
-----------
DEFINITION MODULE impb ;
IMPORT impc ;
TYPE
C = impc.C ;
END impb.
-----------
DEFINITION MODULE impc ;
TYPE
C = (red, blue, green) ;
END impc.
In module impf it seems clear that the variable declaration of, b, is
legal. Is it also legal to access impb.red and impb.green? Or should
it have to import C from impc. I can see advantages in both, allowing
impb.red and also disallowing impb.red but which is correct? The
answer must be the same if we complicate the question by repacing
impb with:
DEFINITION MODULE impb ;
IMPORT impc ;
TYPE
C = PROCEDURE () : impc.C ;
END impb.
I think :-)
Gaius
- [Gm2] enumerated types and import rules,
Gaius Mulley <=