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: a07f3367d7,70414f56d810c10c X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!f8g2000yqf.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Sun, 18 Sep 2011 16:44:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9f37b726-d80b-4d24-bf3f-28a14255f7fd@s20g2000yql.googlegroups.com> <86015926-d652-4265-aedd-413312d399f9@dq7g2000vbb.googlegroups.com> <0d272f62-67d0-4905-972c-8a7e912c5531@en1g2000vbb.googlegroups.com> <148cxoyabima2.16mz6xwdph2hj.dlg@40tude.net> <01a1374f-59ab-40be-9e39-0640cb2a513d@n35g2000yqf.googlegroups.com> <1fp2o673mu9az$.d9loz1zbcl0d.dlg@40tude.net> <1q85zv3i9ccq6$.17nr90hvonwic$.dlg@40tude.net> NNTP-Posting-Host: 123.225.40.167 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1316389448 18036 127.0.0.1 (18 Sep 2011 23:44:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 18 Sep 2011 23:44:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f8g2000yqf.googlegroups.com; posting-host=123.225.40.167; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKUARELSC X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:21965 Date: 2011-09-18T16:44:08-07:00 List-Id: >>> X + Y >> If semantics of smart pointer differs from semantics of value, it may >> make misunderstanding. > > There is no difference, compare it with by-reference parameters. The > program shall not be written to exploit by-reference vs. by-value. Smart > pointer is a substitute for what it points to. Ada has mainly value semantics. If container is intended to be used as value (like Indefinite_Holder), "substitutable" is natural. But if container is intended to be used as access type (like smart pointer or handle), I think, it is unnatural. Because we can define another operation having same name for access type. type Integer_Access is access Integer; function "+" (Left : Integer_Access; Right : Storage_Offset) return Integer_Access; declare a, b : Integer; c : Integer_Access; d : Storage_Offset; begin a + b -- sum of integers c + d -- address arithmetic c.all + d -- sum of referenced integer and offset value end; (of course, we usually does not address arithmetic with smart pointer. this is supposed story.)