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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,70414f56d810c10c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.33.71 with SMTP id p7mr527900pbi.1.1316660751529; Wed, 21 Sep 2011 20:05:51 -0700 (PDT) MIME-Version: 1.0 Path: lh7ni2262pbb.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: discriminant questions Date: Wed, 21 Sep 2011 22:05:45 -0500 Organization: Jacob Sparre Andersen Research & Innovation 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> <1b7pl1piwc3hl.7q9fyyq8h3m7.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1316660749 3369 69.95.181.76 (22 Sep 2011 03:05:49 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 22 Sep 2011 03:05:49 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-RFC2646: Format=Flowed; Original Xref: news1.google.com comp.lang.ada:18074 Date: 2011-09-21T22:05:45-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:pvjwyqljhfih.1d1hj4pze7bpl$.dlg@40tude.net... ... > P.S. I also see little or no point in using "accessors". Primitive > operations Set and Get would be as good/bad. They are also cleaner, much > more efficient and, what is far more important, they are *primitive*. > Accossor is a new type which means *contravariance*. The stuff is not > composable under inheritance. I agree with all of this except the part about "much more efficient". Since such routines require copying the entire element, they cannot be more efficient than a construct that does not require such copying. Get/Set (really Element/Replace_Element) are good, so long as copying the element is cheap or you only need to modify the entire element. But if you have a large element where only a small part will be modified, Set simply isn't practical. All you can do is introduce an explicit access type, which is *exactly* what you don't want (because it forces the client to do all of the memory management). You could of course just return a reference to the element in place instead, but that sacrifies all safety -- that might be OK in the C++ library, but it is unacceptable in Ada. Randy.