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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e008f8da6c083c62,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g4g2000hsf.googlegroups.com!not-for-mail From: adam.betts155@gmail.com Newsgroups: comp.lang.ada Subject: Anonymous access types Date: Fri, 08 Jun 2007 02:29:48 -0700 Organization: http://groups.google.com Message-ID: <1181294988.270499.202550@g4g2000hsf.googlegroups.com> NNTP-Posting-Host: 85.118.3.38 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1181294988 2648 127.0.0.1 (8 Jun 2007 09:29:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Jun 2007 09:29:48 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g4g2000hsf.googlegroups.com; posting-host=85.118.3.38; posting-account=XCgU6Q0AAADnvDnlqBR5Sijc4OfKVWs2 Xref: g2news1.google.com comp.lang.ada:16100 Date: 2007-06-08T02:29:48-07:00 List-Id: I am having some trouble with anonymous access types, behaviour which I do not understand. I have 2 questions: 1) This one is bizarre and quite non-deterministic. I *sometimes* get a "finalize/adjust raised exception" with the following bit of code: declare t_ptr : tree_pointer := new tree'(get_tree(g)); anon_t_ptr : access tree'class := new tree'(get_tree(g)); lca : least_common_ancestor(anon_t_ptr); begin end; with the following type declarations: tree_pointer is access tree'class; type least_common_ancestor (tree_ptr: access constant tree'class); It seems that there is sometimes a problem with the lca declaration, since the exception is never raised when anon_t_ptr is replaced with t_ptr. 2) I want to return an anonymous access type from a function: function get_tree (g: graph) return non null access tree is begin return new tree(g.t); end get_tree; The access type is not null when I use this function. However, when I run the code and try to do operations on the access type, it is not pointing in the right place. For example, the returned tree does not have vertices and edges even though I know it does. Any help with either of these issues would be greatly appreciated.