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,735c710b5e547bad X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Received: by 10.224.182.77 with SMTP id cb13mr1308762qab.5.1343312979404; Thu, 26 Jul 2012 07:29:39 -0700 (PDT) Received: by 10.66.89.161 with SMTP id bp1mr1608573pab.33.1343312648109; Thu, 26 Jul 2012 07:24:08 -0700 (PDT) Path: a15ni105485768qag.0!nntp.google.com!q21no13891737qas.0!news-out.google.com!b9ni61428159pbl.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!feed-C.news.volia.net!volia.net!news2.volia.net!feed-A.news.volia.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.straub-nv.de!uucp.gnuu.de!feed.cnntp.org!news.cnntp.org!weretis.net!feeder1.news.weretis.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.178.16.MISMATCH!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada 2005 puzzle Date: Fri, 20 Jul 2012 01:09:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: <72bc2c23-4a1c-4c09-985e-8cc4c0fd957f@googlegroups.com> References: <1arp60wtxes8h$.1qs6bt732ztgp.dlg@40tude.net> <030cde76-7435-405d-9f12-ac7f730ecab8@googlegroups.com> <1f9q6vk5z2r3t$.1hayo9rmxfwu7$.dlg@40tude.net> <7308644e-bfbe-44c1-8359-d67392d483e1@googlegroups.com> NNTP-Posting-Host: 195.182.34.201 Mime-Version: 1.0 X-Trace: posting.google.com 1342771785 24379 127.0.0.1 (20 Jul 2012 08:09:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 20 Jul 2012 08:09:45 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.182.34.201; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-Received-Bytes: 4785 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: 2012-07-20T01:09:45-07:00 List-Id: W dniu pi=C4=85tek, 20 lipca 2012 04:41:46 UTC+2 u=C5=BCytkownik Randy Bruk= ardt napisa=C5=82: > Sure, it's frequent. But it's still not what you *really* want, b= ecause you=20 > almost always need some copying. No, or at least I cannot find any extensive support for your claim in my wo= rk. If I say that I don't need copying, then it means that I *really* don't= need it, not that this is still not what I *really* want (I have messed th= at sentence on purpose). If I'm forced to provide some copy semantics even = if it was not identified in the design stage, then it is because some other= things (language rules? container design? others?) are messed up. We should fix what is broken. > For example, you can't put limited objects into containers. Then we have poor containers. Let's take existing Query_Element-like operations for inspiration. What abo= ut: procedure Insert (C : in out Container; Constructor : not null access function return T); with intended support for downward closures via local and non-local constru= ctor functions. T can be limited or even class-wide limited (which is even = more useful). With existing rules for in-place return that should be enough - there is no= need for explicit access types *outside* of the container and consequently= no need for Unchecked_Deallocation. The container might need to use them i= nternally, but this is nothing new and we need not care anyway. Is there any language corner that I have missed? Interestingly, I cannot succeed with a test program for the above concept: procedure Test is type T is limited null record; =20 function Create_T return T is begin return V : T do null; end return; end Create_T; procedure Insert (Constructor : not null access function return T) is type T_Ptr is access T; P : T_Ptr; begin P :=3D new T'(Constructor.all); -- compiler error end Insert; begin Insert (Create_T'Access); end Test; In the marked line the compiler says: "initialization not allowed for limit= ed types". What initialization? It *does* work when instead of this: P :=3D new T'(Constructor.all); I use this: P :=3D new T'(Create_T); This suggest that the compiler error message is misleading and in fact the = compiler just cannot process what seems to be a valid construct (pun intend= ed). Is this a compiler bug? > you need some sort of copy to get the=20 > objects into (and something out of) the container. I argue that with appropriate container interface you don't need any copyin= g and you don't need to expose explicit memory management (not counting com= piler bugs). > I=20 > personally would rather be *clever* to *fix* something than to retreat in= to=20 > 1980's programming that cannot be done right by any technique. But yo= ur=20 > mileage may vary. My mileage is that we have to fix what is broken, instead of hacking around= it. --=20 Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com