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, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6dd0409a547aa7b0,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!q2g2000cwa.googlegroups.com!not-for-mail From: "Adam Beneschan" Newsgroups: comp.lang.ada Subject: Statically matching constraints Date: 2 Feb 2007 16:26:19 -0800 Organization: http://groups.google.com Message-ID: <1170462379.446684.247730@q2g2000cwa.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1170462384 1818 127.0.0.1 (3 Feb 2007 00:26:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 3 Feb 2007 00:26:24 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q2g2000cwa.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news2.google.com comp.lang.ada:8857 Date: 2007-02-02T16:26:19-08:00 List-Id: I'm having a bit of trouble understanding the "both are nonstatic and result from..." clause of 4.9.1(1.3/2). According to 7.3(13), if you have a discriminant on the ancestor subtype of a private extension, the full definition must impose a statically matching constraint, which takes you to 4.9.1. With this in mind, which of these examples is legal? package Pak1 is X : Integer := 3; type T1 (A : Integer) is tagged null record; type T2 is new T1(X) with private; private type T2 is new T1(X) with null record; end Pak1; package Pak2 is X : constant Integer := Some_Other_Package.Some_Function(100); type T1 (A : Integer) is tagged null record; type T2 is new T1(X) with private; private type T2 is new T1(X) with null record; end Pak2; package Pak3 is X : Integer := 3; type 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), 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.) -- thanks, Adam