sommar@enea.UUCP (Erland Sommarskog) (07/07/87)
The following declaration is incorrect (LRM 3.7.1(6)): TYPE Nisse(Size : integer_type) IS RECORD A : Array(1..Size) of integer; B : Array(1..2*Size) of integer; END; Does anyone know why? I can understand forbidding a dynamic expression, but a static? -- Erland Sommarskog ENEA Data, Stockholm sommar@enea.UUCP
dik@cwi.nl (Dik T. Winter) (07/08/87)
In article <2079@enea.UUCP> sommar@enea.UUCP(Erland Sommarskog) writes: > > The following declaration is incorrect (LRM 3.7.1(6)): > > TYPE Nisse(Size : integer_type) IS > RECORD > A : Array(1..Size) of integer; > B : Array(1..2*Size) of integer; > END; > > Does anyone know why? I can understand forbidding a dynamic expression, > but a static? (It would perhaps be better if programs posted to the net where at least syntactically correct in order to reduce the number of messages pointing to syntactic errors. The following comments refer to this part after making it syntactically correct.) Yes, 3.7.1(6) explicitly states that discriminants may be used in subtype definitions (as is done here), but in that case cannot be used in larger expressions. Anyhow, you appear to understand forbidding dynamic expressions, can you elaborate? At least, the context here is dynamic and non-static (a discriminant is never static). I think the designers wanted to avoid the need for a system to produce run-time routines for many declarations (as in Algol-68), but for a full explanation we have to wait for the Rationale of course. -- dik t. winter, cwi, amsterdam, nederland INTERNET : dik@cwi.nl BITNET/EARN: dik@mcvax
stt@ada-uts (07/10/87)
I think it was strictly an implementability issue. As a compiler-writer, I certainly sympathize with the restriction. As a user of Ada, I agree the restriction seems arbitrary and not philosophically justifiable. By the way, the expression is not "static" in the normal Ada sense, since the value of a discriminant is not a static expression. Finally, a record type definition must end with "end record;" rather than simply "end;" Tucker Taft c/o Intermetrics, Inc. Cambridge, MA 02138