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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9a7ca14e457ad414 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-15 08:30:38 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!pipex!uunet!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Ada 9X question: accessibility Date: 15 Nov 1994 13:57:42 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3aaeom$qn9@watnews1.watson.ibm.com> References: <3a0hob$h5f@hopper.acm.org> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-11-15T13:57:42+00:00 List-Id: In article , stt@spock.camb.inmet.com (Tucker Taft) writes: |> As you guessed, it makes no difference where Ptr_2 is declared, |> what matters is where its type is declared. In the new terminology, |> the accessibility level of Int_2 is statically deeper than |> the accessibility level of Access_Integer_Type, so the 'Access |> is illegal. It would be helpful to explain why the rule must be based on the depth of the variable's type rather than on the depth of the variable itself: A value stored in a local variable of a global access type can be assigned to a global variable of the same type, thus creating a dangling reference. procedure Example is type Outer_Access_Type is access all Integer; Outer_Variable: Outer_Access_Type; begin declare Inner_Variable : Outer_Access_Type; Target : aliased Integer; begin Inner_Variable := Target'Access; -- ILLEGAL! Outer_Variable := Inner_Variable; end; Outer_Variable.all := Outer_Variable.all + 1; -- dangling reference end Example; -- Norman H. Cohen ncohen@watson.ibm.com