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.200.41.168 with SMTP id 37mr2731434qts.26.1472057151987; Wed, 24 Aug 2016 09:45:51 -0700 (PDT) X-Received: by 10.157.38.178 with SMTP id l47mr380353otb.13.1472057151944; Wed, 24 Aug 2016 09:45:51 -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!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!c52no10686938qte.1!news-out.google.com!d68ni37736ith.0!nntp.google.com!f6no12650011ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Aug 2016 09:45:51 -0700 (PDT) In-Reply-To: <68b89d71-dd92-4b9c-adb9-476a7caa64cf@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.28.146.45; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 174.28.146.45 References: <68b89d71-dd92-4b9c-adb9-476a7caa64cf@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Subtype predicates From: Shark8 Injection-Date: Wed, 24 Aug 2016 16:45:51 +0000 Content-Type: text/plain; charset=UTF-8 X-Received-Bytes: 2457 X-Received-Body-CRC: 3962329275 Xref: news.eternal-september.org comp.lang.ada:31548 Date: 2016-08-24T09:45:51-07:00 List-Id: 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. OTOH, you could certainly consider something like ID_String's predicate as being part of the definition.