From: Anh Vo <anhvofrcaus@gmail.com>
Subject: Re: Subtype predicates
Date: Wed, 24 Aug 2016 14:18:44 -0700 (PDT)
Date: 2016-08-24T14:18:44-07:00 [thread overview]
Message-ID: <83ea6bec-e581-4d64-87e5-2617f76e3e4b@googlegroups.com> (raw)
In-Reply-To: <b007b97f-79a9-44da-beff-2a003831da4f@googlegroups.com>
On Wednesday, August 24, 2016 at 9:45:52 AM UTC-7, Shark8 wrote:
> On Wednesday, August 24, 2016 at 7:06:10 AM UTC-6, AdaMagica wrote:
> > Am Dienstag, 23. August 2016 22:14:30 UTC+2 schrieb Anh Vo:
> > > type Human_Life_Span_Type is range 0 .. 130
> > > with Default_Value => Human_Life_Span_Type'First;
> >
> > No, I think it's the rule that the name of the entity declared in a declaration (here Human_Life_Span_Type) may not be used again in the same declaration. (You cannot use something that is to be defined recursively in the definition.)
> >
> > I just cannot find the RM chapter and verse.
>
> I think it's different for aspects -- similar that Rosen's Trick the name of the declaration is referent to the instance of the type. So we could say something like:
>
> -- A string of upper-case letters followed by a single digit.
> Subtype ID_String is new String
> with Dynamic_Predicate =>
> (For all Index in ID_String'Range =>
> (if Index /= ID_String'Last
> then ID_String(Index) in 'A'..'Z'
> else ID_String(Index) in '0'..'9'
> )
> );
>
>
> And since [some] aspects are essentially attribute-specification clauses (eg "Size => 8" = "For T'Size use 8;") there is some sense in thinking it is/should-be legit.
The 3.5 56.3/3 says that the Default_Value shall be static. Thus, S'First did not comply with Static Semantics. The compiler error should have complained about aspect "Default_Value" requires static expression instead of prefix of "First"... This caused the confusion in the first place.
next prev parent reply other threads:[~2016-08-24 21:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 20:14 Subtype predicates Anh Vo
2016-08-24 13:06 ` AdaMagica
2016-08-24 16:45 ` Shark8
2016-08-24 21:18 ` Anh Vo [this message]
2016-08-24 21:32 ` Shark8
2016-08-24 21:54 ` Jeffrey R. Carter
2016-08-25 0:08 ` Shark8
2016-08-25 0:31 ` Jeffrey R. Carter
2016-08-25 17:28 ` Anh Vo
2016-08-31 18:16 ` Randy Brukardt
2016-09-01 8:09 ` J-P. Rosen
2016-09-01 20:02 ` Randy Brukardt
2016-09-01 20:16 ` Shark8
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox