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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: T'Interface attribute Date: Mon, 7 Aug 2017 17:49:16 -0500 Organization: JSA Research & Innovation Message-ID: References: <74abc378-88a6-49bd-997b-fe25871b7303@googlegroups.com> Injection-Date: Mon, 7 Aug 2017 22:49:17 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="28135"; mail-complaints-to="news@jacob-sparre.dk" 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.7246 Xref: news.eternal-september.org comp.lang.ada:47636 Date: 2017-08-07T17:49:16-05:00 List-Id: "Eryndlia Mavourneen" wrote in message news:74abc378-88a6-49bd-997b-fe25871b7303@googlegroups.com... ... >The whole idea is to have "multiple implementations" of the core task, >tacking on >whatever additional functions may be desired to result in different tasks >but with >some shared functionality. I'm not an Ada language designer, but my >understanding is that the piecing together of tasks in this way is handled >largely >by the compiler and does not *necessarily* involve dispatching: You're right that the specific tasks don't involve dispatching, but if the interfaces are going to have any value at all for their costs, you have to use them by themselves (typically as class-wide parameters to routines). Thus calls to those uses (parameters) them are necessarily dispatching. If you don't actually have dispatching calls, then you are generating a lot of expensive unused code in your program, and most likely bloating your application size. (Janus/Ada can trim unused primitives at link-time, but I don't think any other Ada compiler offers an optimization like that.) And it's very unclear to me what possible gain you get from using interfaces in such a case rather than just declaring the operations you need. Randy. P.S. I see a bit more value to task and protected interfaces to the normal kind, because there is no other way to get dispatching for those types. But still, it seems reasonably rare that dispatching would be useful, since you need a program with multiple tasks implementing the same interface. That doesn't happen often.