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!news3.google.com!feeder.news-service.com!feeder.erje.net!newsfeed.straub-nv.de!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: Derived private interface Date: Wed, 3 Aug 2011 15:16:08 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <27656578-65aa-48b9-9f89-4ebd4e0cb02a@glegroupsg2000goo.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 1312402571 28278 69.95.181.76 (3 Aug 2011 20:16:11 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 3 Aug 2011 20:16:11 +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:20456 Date: 2011-08-03T15:16:08-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:nwyetwf3hqn7$.gm3c388p0s3c$.dlg@40tude.net... > On Tue, 2 Aug 2011 16:16:27 -0500, Randy Brukardt wrote: > >> "Dmitry A. Kazakov" wrote in message >> news:1nvqqny2226ro$.1ixvoiht8zu8l$.dlg@40tude.net... >>> On Mon, 1 Aug 2011 16:56:17 -0500, Randy Brukardt wrote: ... >>>> 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. > > Yes there is some advantage that the function in dispatching constructor > is > primitive: > > function Create (...) return T; There's another advantage (for this use): the language requires you to override it, or you get an error. So it is impossible to forget to write the routine or have it return the wrong kind of object. Errors of omission are the hardest to find, and this property at least prevents those errors. (Of course, it doesn't prevent putting the wrong contents into that object.) Randy.