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: a07f3367d7,187ddf41516e5d0b,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g10g2000yqh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Language lawyer question: access discriminants Date: Tue, 6 Apr 2010 14:17:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: <06e780ef-c171-4037-b96e-f44788ae2bdf@g10g2000yqh.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 1270588625 19009 127.0.0.1 (6 Apr 2010 21:17:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Apr 2010 21:17:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g10g2000yqh.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9900 Date: 2010-04-06T14:17:04-07:00 List-Id: I'm hoping someone who understands the rules about access discriminant accessibility level can answer this definitively. This is a reduced example of something I found in someone else's code: package Pack1 is type Rec is record F1 : Integer; end record; type Rec2 (D : access Rec) is limited record F2 : Integer; end record; function Func (Param : Integer) return Rec2; end Pack1; with Pack1; use Pack1; procedure Proc2 is A : access Rec; begin A := Func(1).D; -- LEGAL? end Proc2; I think the statement marked LEGAL? is illegal, because of rules saying that the result of Func is an object inside a nested master that consists of just the one assignment statement, and the accessibility level of the access discriminant (Func(1).D) is the accessibility level of the enclosing object (the temporary object containing the result of Func), and therefore the accessibility level of Func(1).D is deeper than that of A. But the rules are pretty complex and I'm hoping someone in the know can straighten me out if I'm wrong. (And I'm not interested in any replies that say "XYZ compiler says it's legal". I need to know what the standard says.) -- thanks, Adam