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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Making sense of predicates Date: Wed, 23 Oct 2013 09:56:32 +0200 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: <87a9i0qv2n.fsf@adaheads.sparre-andersen.dk> References: <1830ad81-00dc-4639-922a-771a01cd06ec@googlegroups.com> <87eh7drc61.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: fw2.nbi.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: loke.gir.dk 1382514992 16676 130.225.212.4 (23 Oct 2013 07:56:32 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 23 Oct 2013 07:56:32 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:G2DO/TA9VekdrsbSa7bU0lmvFz4= X-Original-Bytes: 2584 Xref: number.nntp.dca.giganews.com comp.lang.ada:183710 Date: 2013-10-23T09:56:32+02:00 List-Id: Shark8 wrote: > On Tuesday, October 22, 2013 1:35:02 AM UTC-6, Jacob Sparre Andersen wrote: >> 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. I've not tried to work out what differences there must be between how a compiler implements dynamic and static predicates, but I assume that there is a reason that the ARG decided to distinguish between the two cases. > IOW, why is the predicate required to be dynamic when, for example, > "subtype Number_String is Array(Positive range <>) of Digit_Character" That one isn't a subtype, which may hint at the reason. > or "subtype short_String is String(1..255)" is not a > dynamic-predicate? A better example. I'm not sure why, but I suspect that the differentiation is due to how a compiler implements the checks. If we can work out how to make the checks for some classes of (currently) dynamic predicates as simple as those for static predicates, we can probably get the ARG to reclassify those classes of predicates. Greetings, Jacob -- "It ain't rocket science!"