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,5c89acd494ea9116 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!g4g2000hsf.googlegroups.com!not-for-mail From: amado.alves@gmail.com Newsgroups: comp.lang.ada Subject: Re: Self pointer in limited record Date: Mon, 10 Sep 2007 16:27:50 -0000 Organization: http://groups.google.com Message-ID: <1189441670.293887.176810@g4g2000hsf.googlegroups.com> References: <1183577468.034566.57830@n60g2000hse.googlegroups.com> <1188578849.187422.280620@50g2000hsm.googlegroups.com> <9fy1xoukz1e3$.h574sqmiauri$.dlg@40tude.net> NNTP-Posting-Host: 212.54.135.10 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1189441670 6662 127.0.0.1 (10 Sep 2007 16:27:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 10 Sep 2007 16:27:50 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 ebox-adsl.critical.pt:3128 (squid/2.5.STABLE13) Complaints-To: groups-abuse@google.com Injection-Info: g4g2000hsf.googlegroups.com; posting-host=212.54.135.10; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1864 Date: 2007-09-10T16:27:50+00:00 List-Id: > > > ... I wish this were > > > possible myself. Or more simply: > > > > type T is -- limited or not > > > Self : access T := T'Unchecked_Access; > > > ... > > > end; (Marius) > > > T cannot be non-limited, because otherwise passing it by copy would make > > rubbish out of Self. In any case it would make little sense if not access > > T'Class. (Kasakov) > > Sure it can... (Randy) Yes, now the compiler is accepting this (and letting me copy objects, and, yes, getting rubbish in Self). I have no idea why it was not compiling before. It just wasn't. And the messages indicated trouble in the type. So, and because I know that Ada is a very sensitive lady, I jumped to the (wrong) conclusion that the thing was illegal. /* FWIW, the problem was the following. I am writing a library. I wanted to provide a function to the user to allow him to specify the parent of an object in a simple way e.g. Parent_Object : Object := Lookup (Name = "foo foo"); Object : Object := Create (Name => "bla bla", Parent => Parent_Object); The idea was to have a clean profile like Create (Name : String; Parent : Object); instead of Create (Name : String; Parent : access Object); Inside the function there is code like New_Object.Parent := Parent.Self; -- (clean profile) or New_Object.Parent := Parent; -- ('dirty' profile) I am kind of redesigning the library now so these issues are yet in flux. */