From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.144.86 with SMTP id s83mr3994475iod.26.1472073524809; Wed, 24 Aug 2016 14:18:44 -0700 (PDT) X-Received: by 10.157.31.88 with SMTP id x24mr525596otx.4.1472073524785; Wed, 24 Aug 2016 14:18:44 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no12693046ith.0!news-out.google.com!d130ni45722ith.0!nntp.google.com!f6no12693039ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Aug 2016 14:18:44 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.37; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 149.32.224.37 References: <68b89d71-dd92-4b9c-adb9-476a7caa64cf@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <83ea6bec-e581-4d64-87e5-2617f76e3e4b@googlegroups.com> Subject: Re: Subtype predicates From: Anh Vo Injection-Date: Wed, 24 Aug 2016 21:18:44 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:31551 Date: 2016-08-24T14:18:44-07:00 List-Id: 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=20 > > > with Default_Value =3D> Human_Life_Span_Type'First; > >=20 > > No, I think it's the rule that the name of the entity declared in a dec= laration (here Human_Life_Span_Type) may not be used again in the same decl= aration. (You cannot use something that is to be defined recursively in the= definition.) > >=20 > > I just cannot find the RM chapter and verse. >=20 > 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 sa= y something like: >=20 > -- A string of upper-case letters followed by a single digit. > Subtype ID_String is new String > with Dynamic_Predicate =3D>=20 > (For all Index in ID_String'Range =3D>=20 > (if Index /=3D ID_String'Last > then ID_String(Index) in 'A'..'Z' > else ID_String(Index) in '0'..'9' > ) > ); >=20 >=20 > And since [some] aspects are essentially attribute-specification clauses = (eg "Size =3D> 8" =3D "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 d= id not comply with Static Semantics. The compiler error should have complai= ned about aspect "Default_Value" requires static expression instead of pref= ix of "First"... This caused the confusion in the first place.