From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Subtype predicates
Date: Wed, 24 Aug 2016 14:32:10 -0700 (PDT)
Date: 2016-08-24T14:32:10-07:00 [thread overview]
Message-ID: <dfb35c4e-7167-4db1-9a58-d946f4e5dd31@googlegroups.com> (raw)
In-Reply-To: <83ea6bec-e581-4d64-87e5-2617f76e3e4b@googlegroups.com>
On Wednesday, August 24, 2016 at 3:18:47 PM UTC-6, Anh Vo wrote:
> 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.
Why wouldn't 'First (on the discrete-type) be considered Static? It's known at compile-time when the compiler chooses the representation.
next prev parent reply other threads:[~2016-08-24 21:32 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
2016-08-24 21:32 ` Shark8 [this message]
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