comp.lang.ada
 help / color / mirror / Atom feed
From: Eryndlia Mavourneen <eryndlia@gmail.com>
Subject: Re: T'Interface attribute
Date: Sat, 5 Aug 2017 12:02:39 -0700 (PDT)
Date: 2017-08-05T12:02:39-07:00	[thread overview]
Message-ID: <74abc378-88a6-49bd-997b-fe25871b7303@googlegroups.com> (raw)
In-Reply-To: <om32be$eq3$1@franka.jacob-sparre.dk>

On Friday, August 4, 2017 at 7:09:19 PM UTC-5, Randy Brukardt wrote:
> ...
> Interfaces 
> are only useful if there are going to be multiple implementations of them. 
> Otherwise, they just add unspeakable runtime overhead and you're getting 
> nothing for them. Specifically, you have to be able to have useful routines 
> made up of only dispatching calls. When I tried that in the Claw Builder, it 
> turned into a maintenance nightmare - any significant change required a 
> change to every specific type. And adding a new specific type took multiple 
> days (there being so many routines to implement). It just doesn't fit with 
> the agile-style programming that I do.
> 
> >I find this kind of construction most pleasurable to design and implement. 
> >It also
> >is easy to understand.
> 
> Obviously, YMMV. Just don't expect me to push for anything involving 
> interfaces.
> 
>                         Randy.

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:

     type Base_Task is task interface;
     procedure Awaken (...) is abstract;

     type Random_Things is task interface;
     procedure Do_Random_Things is abstract;

     type Persistent is task interface and Base_Task;
     procedure Do_Something (...) is abstract;

     type Temp is task interface and Base_Task;
     procedure Do_Something_Else (...) is abstract;

     ...

     task type Persistent_Task (...) is new Common and Persistent with

        entry Awaken (...);

        entry Do_Random_Things;

        entry Do_Something (...);

     end Persistent_Task;

     ...

This code is "off-the-cuff" and so may be a little off, but I think the intention is clear enough.

  reply	other threads:[~2017-08-05 19:02 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 [this message]
2017-08-07 22:49         ` Randy Brukardt
replies disabled

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