comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: T'Interface attribute
Date: Mon, 7 Aug 2017 17:49:16 -0500
Date: 2017-08-07T17:49:16-05:00	[thread overview]
Message-ID: <omaqpd$rf7$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 74abc378-88a6-49bd-997b-fe25871b7303@googlegroups.com


"Eryndlia Mavourneen" <eryndlia@gmail.com> 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.



      reply	other threads:[~2017-08-07 22:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 13:43 T'Interface attribute Dmitry A. Kazakov
2017-08-02 14:23 ` Eryndlia Mavourneen
2017-08-03 12:52   ` Dmitry A. Kazakov
2017-08-03  4:46 ` Randy Brukardt
2017-08-03  7:26   ` Dmitry A. Kazakov
2017-08-04 23:51     ` Randy Brukardt
2017-08-05  7:49       ` Dmitry A. Kazakov
2017-08-07 22:59         ` Randy Brukardt
2017-08-08  6:13           ` Dmitry A. Kazakov
2017-08-09  0:38             ` Randy Brukardt
2017-08-09  7:06               ` Dmitry A. Kazakov
2017-08-09 23:03                 ` Randy Brukardt
2017-08-10  7:13                   ` Dmitry A. Kazakov
2017-08-11  0:33                     ` Randy Brukardt
2017-08-11  6:55                       ` Dmitry A. Kazakov
2017-08-11 20:49                         ` Randy Brukardt
2017-08-03 17:27   ` Eryndlia Mavourneen
2017-08-05  0:09     ` Randy Brukardt
2017-08-05 19:02       ` Eryndlia Mavourneen
2017-08-07 22:49         ` Randy Brukardt [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox