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,c08a7609345f4e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!n3g2000yqb.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Limited use for limited with? Date: Tue, 28 Sep 2010 14:57:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <67044906-dacc-4526-b3f6-27e5323ab8fc@n3g2000yqb.googlegroups.com> References: <853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com> <36e886fa-b272-461f-bf86-a6b18366b64f@i5g2000yqe.googlegroups.com> <1eug9v5h5mf8d$.ud00hrz48lyr.dlg@40tude.net> NNTP-Posting-Host: 85.1.245.123 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1285711069 14890 127.0.0.1 (28 Sep 2010 21:57:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Sep 2010 21:57:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n3g2000yqb.googlegroups.com; posting-host=85.1.245.123; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14304 Date: 2010-09-28T14:57:49-07:00 List-Id: On 28 Wrz, 15:45, "Dmitry A. Kazakov" wrote: > > Hiding the use of access values behind the scenes (by virtue of tagged > > types being always passed by reference) would obstruct the code > > without clear benefit. > > The benefit is clear - no access types. There are still access types. The fact that they are not explicitly seen in operation signatures just makes it more obscure. No benefit. Consider: procedure Register (X : in Object'Class); X will be passed by reference, but there is still nothing in the signature (apart from the name of the operation) that would suggest that the reference will be leaked out of the operation's scope. So the user does this: declare X : My_Concrete_Object; begin Register (X); endl; and bang, everything breaks into pieces. Whereas this: procedure Register (X : Object_Access); at least forces the user to think about scopes. I therefore consider it to be a safer construct. > You should register the object itself rather than its pointer. Use a > constructing function which registers the object by placing it in a list or > do an explicit call to Register. No way. There are many Registers and it's up to the user to decide where the given object should be registered; constructor has no such knowledge. And *when* it should be registered, which is not necessarily at construction time. > I tend to avoid "all" everywhere I can. Apparently here I cannot. -- Maciej Sobczak * http://www.inspirel.com