comp.lang.ada
 help / color / mirror / Atom feed
* Question about discrimiants
@ 1987-07-07 10:34 Erland Sommarskog
  1987-07-07 23:28 ` Dik T. Winter
  1987-07-10 16:11 ` stt
  0 siblings, 2 replies; 3+ messages in thread
From: Erland Sommarskog @ 1987-07-07 10:34 UTC (permalink / raw)



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        
                        

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about discrimiants
  1987-07-07 10:34 Question about discrimiants Erland Sommarskog
@ 1987-07-07 23:28 ` Dik T. Winter
  1987-07-10 16:11 ` stt
  1 sibling, 0 replies; 3+ messages in thread
From: Dik T. Winter @ 1987-07-07 23:28 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about discrimiants
  1987-07-07 10:34 Question about discrimiants Erland Sommarskog
  1987-07-07 23:28 ` Dik T. Winter
@ 1987-07-10 16:11 ` stt
  1 sibling, 0 replies; 3+ messages in thread
From: stt @ 1987-07-10 16:11 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1987-07-10 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-07-07 10:34 Question about discrimiants Erland Sommarskog
1987-07-07 23:28 ` Dik T. Winter
1987-07-10 16:11 ` stt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox