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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc43b0dfc6b2a131,start X-Google-Attributes: gid103376,public From: adam@irvine.com Subject: Accessibility levels, continued Date: 1999/02/05 Message-ID: <79dse1$ut4$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 440857497 X-Http-Proxy: 1.0 x15.dejanews.com:80 (Squid/1.1.22) for client 192.160.8.21 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Fri Feb 05 04:35:13 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/3.0 (X11; I; Linux 2.0.34 i686) Date: 1999-02-05T00:00:00+00:00 List-Id: Should this program raise an exception? procedure Test is type T is record Field : Integer; end record; Var : T; type Access_T is access T; Acc_Var : Access_T; procedure Outer (Outer_Param : access T) is procedure Inner (Inner_Param : access T) is begin Acc_Var := Inner_Param.all'access; -- [1] end Inner; begin Inner (Outer_Param); end Outer; begin Outer (Var'access); -- [2] end Test; It doesn't look like it should, if you follow the intent of the accessibility rules in 3.10.2. Acc_Var will be assigned to an access to Var, and since Acc_Var's type does not have a deeper accessibility level than Var, everything should be fine. However, I believe that the way the RM is written, the program should raise Program_Error at line [1]. Here's what seems to be going on: 3.10.2(29): 'ACCESS will succeed as long as the accessibility level of Inner_Param.all is not deeper than that of Access_T. 3.10.2(15): The accessibility level of Inner_Param.all equals that of Inner_Param's type, which is an anonymous access type. 3.10.2(13): The accessibility level of Inner_Param's anonymous access type is the same as that of the view designated by the actual, in this case Outer_Param. I don't know the exact meaning of the "view designated by the actual" when the actual is another parameter. I haven't found any reason to believe that the last clause of the above paragraph is different from, more simply, "the accessibility level of Outer_Param". Which leads us to: 3.10.2(7): Since Outer_Param is a parameter, the accessibility level of Outer_Param is the same as its master, Outer. Stringing everything together, the accessibility level of Inner_Param.all'access is the same as that of Outer; and since the accessibility level of Outer is deeper than that of Access_T, the program should raise a Program_Error. Is this the right interpretation? Or did I miss something? -- thanks, Adam -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own