comp.lang.ada
 help / color / mirror / Atom feed
* Re: 'Base and Staticness
       [not found] <12293281394.11.MENDAL@Sierra.Stanford.EDU>
@ 1987-04-13 13:45 ` arny
  1987-04-14  8:48   ` deller
  0 siblings, 1 reply; 2+ messages in thread
From: arny @ 1987-04-13 13:45 UTC (permalink / raw)


In article <12293281394.11.MENDAL@Sierra.Stanford.EDU>, Mendal@SIERRA.STANFORD.EDU (Geoff Mendal) writes:
> Is the following package specification semantically valid?
> 
>   package Static_Test is
>     subtype Non_Static is Integer range Integer (1) .. 100;
> 
>     type Must_Be_Static is range Non_Static'Base'First .. 10;
>   end Static_Test;
> 
> Read the ARM, 3.3.3(8..9) and 4.9(1..2, 8, 11).


   Forgive me if I missed something, but after checking the LRM sections you
mentioned above (especially 4.9:11), I believe the subtype "Non_Static" is
indeed static.  This subtype is formed by imposing a static range constraint
(1..100) on a scalar base type (Integer).  (Note that enclosing the numeral 1
in parentheses does not make it non-static according to 4.9:2,4,10).
   It follows that the declaration of "Must_Be_Static" is then valid according
to 4.9:8.

   Comments?

Arny B. Engelson   {ihnp4|bonnie|clyde}!wayback!arny   (201) 386-4816
AT&T Bell Laboratories, Whippany, N.J.

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

* Re: 'Base and Staticness
  1987-04-13 13:45 ` 'Base and Staticness arny
@ 1987-04-14  8:48   ` deller
  0 siblings, 0 replies; 2+ messages in thread
From: deller @ 1987-04-14  8:48 UTC (permalink / raw)


In article <1132@wayback.UUCP>, arny@wayback.UUCP (Arny B. Engelson) writes:

> > Is the following package specification semantically valid?
> >   package Static_Test is
> >     subtype Non_Static is Integer range Integer (1) .. 100;
> >     type Must_Be_Static is range Non_Static'Base'First .. 10;
> >   end Static_Test;
> > Read the ARM, 3.3.3(8..9) and 4.9(1..2, 8, 11).
> 
> ... I believe the subtype "Non_Static" is
> indeed static.  This subtype is formed by imposing a static range constraint
> (1..100) on a scalar base type (Integer).  (Note that enclosing the numeral 1
> in parentheses does not make it non-static according to 4.9:2,4,10).
> . . .

I believe you missed the fact that instead of "1", the expression is 
"Integer (1)", not simply "(1)".  "Integer (1)" is a type conversion, which is 
not listed in RM 4.9 as a static primary.  Using a "non-modifying" type
conversion is one of the typical "tricks" used to make expressions non-static.

Note that "Integer'(1)" is a qualified expression, which _is_ a static 
expression primitive, and is more likely to be used when "casting" (What, how
did C sneak in here?) a literal to a specific type.

Steven Deller,
Verdix
-- 
<end_message> ::= <disclaimer> | <joke> | <witty_saying> | <cute_graphic>
{verdix,seismo,umcp-cs}!vrdxhq!deller

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

end of thread, other threads:[~1987-04-14  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <12293281394.11.MENDAL@Sierra.Stanford.EDU>
1987-04-13 13:45 ` 'Base and Staticness arny
1987-04-14  8:48   ` deller

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