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: a07f3367d7,158ce2376534c35d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!goblin3!goblin1!goblin.stu.neva.ru!news.tornevall.net!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: Derived private interface Date: Tue, 2 Aug 2011 16:16:27 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <27656578-65aa-48b9-9f89-4ebd4e0cb02a@glegroupsg2000goo.googlegroups.com> <0fe3b0f8-c064-444d-899d-640e891b58c3@w4g2000yqm.googlegroups.com> <128d8eb5-1cc6-47e3-a09b-b53a5ef289ce@m10g2000yqd.googlegroups.com> <4e141501$0$6629$9b4e6d93@newsspool2.arcor-online.net> <4b2728fc-6127-45d8-a314-9fc491701c26@g12g2000yqd.googlegroups.com> <82vcve4bqx.fsf@stephe-leake.org> <4e15b223$0$6541$9b4e6d93@newsspool4.arcor-online.net> <1rlxo1uthv5xt.1agapd9q0mek4$.dlg@40tude.net> <1nvqqny2226ro$.1ixvoiht8zu8l$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1312319790 10848 69.95.181.76 (2 Aug 2011 21:16:30 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 2 Aug 2011 21:16:30 +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.6109 Xref: g2news1.google.com comp.lang.ada:20448 Date: 2011-08-02T16:16:27-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1nvqqny2226ro$.1ixvoiht8zu8l$.dlg@40tude.net... > On Mon, 1 Aug 2011 16:56:17 -0500, Randy Brukardt wrote: > >> "Dmitry A. Kazakov" wrote in message >> news:1rlxo1uthv5xt.1agapd9q0mek4$.dlg@40tude.net... >> ... >>> BTW, Generic_Dispatching_Constructor of Ada 2005 did not change much to >>> Ada >>> 95 because of tags. You still need a registering layer to maintain >>> external name to tag mapping. >> >> It did eliminate one thing, the need to have a scheme to create an object >> of >> each tagged type. That forced the use of either a case statement or an >> access-to-subprogram, either of which is error-prone. > > I don't consider the case statement because it is just a wrong pattern. > Regarding mappings type ID to either a constructing function or tag, they > are equivalent. Both require the same amount of maintenance. There are more sources of error when using access-to-subprogram; it's easy to forget to create a routine or use the wrong one. Neither of those are possible with generic dispatching constructor (or with a case statement, for that matter, presuming that you use Ada's completeness checks). This is a minor advantage, but it is real; it's the major reason that I don't even think about using access-to-subprogram (and have to be reminded of the possibility). >> There is no possibility of eliminating the need for some sort of registry -- >> although in some cases you can use the one built-into the language (the >> External_Tag). There has to be a mapping somewhere of some sort of key to >> a >> tag, since it isn't possible to export tags to the "real world". > > It is possible, and even required for distributed weakly coupled > applications, but in order to do that you have to export the types > themselves rather than their tags. It might be possible for some non-Ada language, but it's not possible for Ada (and this is an Ada site and I was only talking about Ada here). There is no way in Ada to "export the types"; you have to export some type indication -- and that requires some sort of mapping of indication to type. Randy.