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,29d8139471e3f53e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Preventing type extensions Date: Mon, 13 Sep 2010 23:21:28 +0300 Organization: Tidorum Ltd Message-ID: <8f7fe9F2nlU1@mid.individual.net> References: <87iq2bfenl.fsf@mid.deneb.enyo.de> <874odv9npv.fsf@ludovic-brenta.org> <87y6b7cedd.fsf@mid.deneb.enyo.de> <66a3704c-54f9-4f04-8860-aa12f516134b@t3g2000vbb.googlegroups.com> <87d3sib44t.fsf@mid.deneb.enyo.de> <134q4k2ly2pf4$.17nlv1q6q5ivo.dlg@40tude.net> <4c8dec8e$0$6990$9b4e6d93@newsspool4.arcor-online.net> <8f6cceFrv2U1@mid.individual.net> <18oiywskxfib5.9den27hp0plc.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net YG2zgfn3smLMiwynigw2Uw3nwwX8y424k5RBRwGmtcdKMQLocg Cancel-Lock: sha1:v9nj7FSdIEhUMWGsoRWiETph+HQ= User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) In-Reply-To: <18oiywskxfib5.9den27hp0plc.dlg@40tude.net> Xref: g2news1.google.com comp.lang.ada:14053 Date: 2010-09-13T23:21:28+03:00 List-Id: Dmitry A. Kazakov wrote: > On Mon, 13 Sep 2010 13:23:10 +0300, Niklas Holsti wrote: > >> Dmitry A. Kazakov wrote: >> >>> re-dispatch is the problem, not aggregation or delegation. Don't implement >>> anything by means of re-dispatch and you will have no "callbacks." A type >>> extension cannot break anything in the parent's implementation unless it >>> re-dispatches. >> Conversely, there are architectures (sensible ones, in my opinion) in >> which the extension is broken, or is difficult or cumbersome to >> implement, if the parent does *not* re-dispatch. > > I am not sure if these case aren't kludges caused by other language > deficiencies (e.g. lack of MI, MD, constructors etc). I agree that re-dispatching can be used to simulate multiple dispatching (MD) in Ada. I have no experience of languages that allow multiple inheritance or multiple dispatch, so they are not in my design tool-kit. But in the designs where I have used Ada re-dispatching, I don't see how MI/MD could have replaced re-dispatching; they seem unrelated. >> Next question: Should the language provide means to express the uses of >> re-dispatch, in the declaration of a tagged type and its operations? For >> example, "primitive operation Foo calls primitive operation Bar with >> re-dispatch". > > In my view a better alternative would be extensible primitive operations, > when "overriding" rather inserts prologue or epilogue than replaces all > body. That would not have replaced re-dispatching, as I have used it. My re-dispatching calls are interleaved in a more complex way with the logic of the calling operation. > One could consider dispatch restricted to class-wide operations while > allowing T'Class'Class. Then operations class-wide for T would be primitive > for T'Class. I.e. one could override them within T'Class'Class. I think an example is needed before I can understand that. Which objects are in T'Class'Class, but not in T'Class? Re-dispatching calls from a primitive (non-class-wide) operation can sometimes be replaced by dispatching calls from a class-wide operation, and that can clarify a design. Perhaps your suggestion is an extension of this? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .