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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 27 Jun 2013 09:36:56 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: "accessibility check failed" on Node References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <51cbeb92$0$6575$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 27 Jun 2013 09:36:50 CEST NNTP-Posting-Host: d25e202d.newsspool3.arcor-online.net X-Trace: DXC=R>T\`3kH6gVHigV@eW57PQMcF=Q^Z^V3X4Fo<]lROoRQ8kFejVX@DDR=TK7DU] On 27.06.13 01:01, Thomas Schmidt wrote: > Hi, > > I'm new to Ada. I'm trying to write some kind of neural net software. Therefore I've written a small library to implement the neural graph. All nodes are collected in a Hashed_Set. Neurons are specialized Nodes of the graph. To lookup a given Neuron/Node I need the following subprogram "findNode". > > Now what I don't understand: Why does "findNode1" work well while "findNode2" raises PROGRAM_ERROR at the line indicated below? > position : constant NodeSets.Cursor := > graph.nodes.Find (Node (aNode.all)'Access); -- <<< Works well > position : constant NodeSets.Cursor := > graph.nodes.Find (aNode.all'Access); -- <<< Raises PROGRAM_ERROR with "accessibility check failed" The only written difference I see is that the type of the object whose 'Access is taken in findNode1 is Node, whereas the type of aNode.all in findNode2 is not necessarily Node. Node is the type used as target type of what is in the container. If aNode is a pointer to type that is not declared at the same level as type Node, then this former type may no longer be accessible. Therefore, anything specific to the type is assumed to be gone, including any specific 'Address operation. (E.g., Node may be declared at library level, and Some_Other_Node declared inside some procedure, or in some generic instance not at library level.) Some ways of identifying a node can be less troublesome than using its address. Any identity less accidental than addresses facilitates persistent identities. Have you looked at the indefinite containers?