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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Seeking for papers about tagged types vs access to subprograms Date: Thu, 2 May 2013 16:49:18 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <1d73jn954z90t.ze60axadntyr$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1367531364 21543 69.95.181.76 (2 May 2013 21:49:24 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 2 May 2013 21:49:24 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Original-Bytes: 3067 Xref: number.nntp.dca.giganews.com comp.lang.ada:181363 Date: 2013-05-02T16:49:18-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1d73jn954z90t.ze60axadntyr$.dlg@40tude.net... > On Wed, 1 May 2013 20:09:46 -0500, Randy Brukardt wrote: ... >> Nitpick: "new" is not an operator, it is an *operation*, things whose >> behavior cannot be modified directly. Like membership, it would be hard >> to >> make "new" an operator because one of the arguments can be a type (rather >> than an object or value), and it's hard to see how that could be mapped >> to >> an Ada function. (Adding type parameters seems over the top.) > > type Root_Access_Type is interface ...; > function "new" return Root_Access_Type is abstract; > > If access types were "untagged" class, "new" would be a plain primitive > operation. You're missing something here, and that's the information about the designated type/object. If you have: Ptr := new Piece (Color => Black); that information about the discriminant has to be transmitted somehow as it can controls the size of the allocated object. The same is true of initial values. In a strongly-typed system, these things can't be separated (you could of course pass the size as a parameter but that would be untyped, as there would be no way to ensure that the correct size is passed for the initial value). Besides, if you wanted that, you could use storage pools; the point was that there is no way to directly model an allocator as an operator call (which is necessarily a normal function call). Using some other form of call is not how operators work (we have the term "operation" for that). Similar thoughts apply to memberships like "obj in T'Class". One might be able to write a function to implement that, but you'd have to pass tags to do so, which would bear no resemblance to normal subprogram call (it would be much more like the relationship of a storage pool to an allocator). Randy.