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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6dd0409a547aa7b0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Sat, 03 Feb 2007 08:41:47 -0600 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Statically matching constraints References: <1170462379.446684.247730@q2g2000cwa.googlegroups.com> Date: Sat, 03 Feb 2007 15:41:45 +0100 Message-ID: <87mz3vmhg6.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:sh+/EL/nWL1LBeKwDzlLPTRUvog= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 62.235.246.195 X-Trace: sv3-14sq6F23mhcuBsdlJX30LOV0YFjEKMxF8WFGf3KOf9R2b/yFS8mTU0SJnfwuZZ1YEw1ukq5pzSMaSHF!RYi5FprFlrWnOwp7KK49y5jGb2jrKPgdTRg/PIzGUlE71v1iiBfRR2a4uZk9JG23nr3JgQYR8/U= X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:8874 Date: 2007-02-03T15:41:45+01:00 List-Id: Adam Beneschan writes: > package Pak3 is > X : Integer := 3; > type Sub is Integer range 1..X; Surely you meant subtype Sub is Integer range 1 .. X; > type T1 (A : Integer) is tagged null record; > type T2 is new T1(Sub'Last) with private; > private > type T2 is new T1(Sub'Last) with null record; > end Pak3; > > My reading is that Pak1 and Pak2 are illegal but Pak3 seems to be > legal. The constraints are all nonstatic (the fact that X is a > constant in Pak2 isn't enough to make it static), X would be static, I think, if Some_Function were a static function, since you are already passing a static parameter to Some_Function. That would make Pak2 legal. > but it seems to me > that Pak3 is the only one where the constraint results from something > mentioned in 4.9.1(1.3/2), since it seems to result from "the same > evaluation of a range of a discrete_subtype_definition", while in Pak1 > and Pak2 the constraints result from evaluations of a variable or > constant, respectively. But it's a little confusing to me because I'm > not clear on just what "result from" is supposed to mean, and the AARM > is no help. > > Is my interpretation correct? > > (And yes, I already know you can make this legal by eliminating the > discriminant from the private extension declaration. That isn't my > question.) How about type T1 (A : Integer) is tagged null record; type T2 is new T1(A : Integer) with private; private type T2 is new T1(A => X) with null record; Would that be legal? Sorry I can't be of more help, asking more questions instead of answering :) but FWIW I agree with your interpretation of 4.9.1(1.3/2). -- Ludovic Brenta.