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.58.1.1 with SMTP id 1mr4433593vei.23.1382462770961; Tue, 22 Oct 2013 10:26:10 -0700 (PDT) X-Received: by 10.182.44.163 with SMTP id f3mr23852obm.34.1382462770496; Tue, 22 Oct 2013 10:26:10 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!i2no27550051qav.0!news-out.google.com!z6ni86859pbu.0!nntp.google.com!i2no27550030qav.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 22 Oct 2013 10:26:10 -0700 (PDT) In-Reply-To: <87eh7drc61.fsf@adaheads.sparre-andersen.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=97.123.228.141; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 97.123.228.141 References: <1830ad81-00dc-4639-922a-771a01cd06ec@googlegroups.com> <87eh7drc61.fsf@adaheads.sparre-andersen.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Making sense of predicates From: Shark8 Injection-Date: Tue, 22 Oct 2013 17:26:10 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 2661 Xref: number.nntp.dca.giganews.com comp.lang.ada:183703 Date: 2013-10-22T10:26:10-07:00 List-Id: On Tuesday, October 22, 2013 1:35:02 AM UTC-6, Jacob Sparre Andersen wrote: > Shark8 writes: > > > Agreed; I was disappointed the following doesn't work: > > > > Subtype Digit_Character is Character range '0'..'9'; > > Subtype Part_Number is String > > with Static_Predicate => (for all C in Part_Number => C in Digit_Character); > > > > As it would be nice to basically subtype out [further-constrain] the > > element-type just as we can do to the index (e.g. "Subtype > > Phone_Digits is String(1..7);", which is equivalent to "subtype > > phone_range is Positive range 1..7; Subtype Phone_Digits is > > String(Phone_Range);", where 'phone_range' is an anonymous subtype.) > > If you did it right, it would work: > > package Parts is > subtype Digit_Character is Character range '0' .. '9'; > subtype Part_Number is String > with Dynamic_Predicate => (for all C of Part_Number > => C in Digit_Character); > end Parts; I think you misunderstand my point: there's no real reason [at least that I can tell (apart from syntax, possibly)] that an array-type cannot be subtyped in order to place additional [static] constraint upon the base-type. IOW, why is the predicate required to be dynamic when, for example, "subtype Number_String is Array(Positive range <>) of Digit_Character" or "subtype short_String is String(1..255)" is not a dynamic-predicate?