comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Callback in Ada
Date: Sat, 27 Nov 2010 14:05:07 -0800 (PST)
Date: 2010-11-27T14:05:07-08:00	[thread overview]
Message-ID: <20070c79-c5a7-4119-8b02-aafea42dec70@j1g2000vbl.googlegroups.com> (raw)
In-Reply-To: 87bp5boylc.fsf@ludovic-brenta.org

On 27 Lis, 11:22, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:

> There are alternatives to callbacks; for example I believe Claw and Qt
> use overriding primitive operations instead of callbacks.

YAMI4 uses this approach for delivering messages and various
notifications.
AWS uses this, too.

You have left that at the end of the list as if it was the least
capable option, but I think that callbacks implemented this way (in
particular with interfaces) have several important advantages:

1. They can be stateful. Procedure callbacks can refer to enclosing
state as well, but for example having an array of stateful callbacks
is less obvious. Interfaces can do that.

2. They are composable. A single entity can implement many callbacks
and this can be enforced at the level of type system, not by mere
convention.

3. Last but certainly not least: they can be implemented directly as
protected or task objects.

I would not use them for the passive iterator idiom, but for any form
of asynchronous delivery, they can be very powerful.

--
Maciej Sobczak * http://www.inspirel.com



  parent reply	other threads:[~2010-11-27 22:05 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-27  9:47 Callback in Ada Georg Maubach
2010-11-27 10:11 ` Dmitry A. Kazakov
2010-11-27 10:22 ` Ludovic Brenta
2010-11-27 11:04   ` Vinzent Hoefler
2010-11-27 22:05   ` Maciej Sobczak [this message]
2010-11-27 10:26 ` Alex Mentis
2010-11-27 10:46 ` Vinzent Hoefler
2010-11-27 11:32 ` Georg Bauhaus
2010-11-27 21:11   ` Jeffrey Carter
2010-11-27 21:20     ` Dmitry A. Kazakov
2010-11-28 21:35       ` Maciej Sobczak
2010-11-29  8:41         ` Dmitry A. Kazakov
2010-11-29 10:12           ` Maciej Sobczak
2010-11-29 11:04             ` Dmitry A. Kazakov
2010-11-30  1:32               ` Randy Brukardt
2010-11-30  8:38                 ` Dmitry A. Kazakov
2010-11-30  9:14                 ` AdaMagica
2010-11-30 12:37                   ` Georg Bauhaus
2010-11-30 20:28                     ` Randy Brukardt
2010-11-30 20:31                   ` Randy Brukardt
2011-01-01 16:46                 ` Yannick Duchêne (Hibou57)
2011-01-02 10:14                   ` AdaMagica
2011-01-02 14:11                     ` Robert A Duff
2011-01-02 15:15                       ` AdaMagica
2011-01-02 15:28                         ` Robert A Duff
2011-01-02 15:38                       ` Alex Mentis
2011-01-02 15:44                         ` Robert A Duff
2011-01-03 21:38                           ` Randy Brukardt
2011-01-04  0:11                             ` Robert A Duff
2011-01-04 18:33                             ` Alex Mentis
2011-01-04 19:47                               ` Robert A Duff
2011-01-04 20:21                                 ` Randy Brukardt
2011-01-04 20:15                               ` Randy Brukardt
2010-11-29 15:24     ` Callback in Ada (User Data argument) Warren
2010-11-30  1:35       ` Randy Brukardt
2010-11-30 16:51         ` Warren
replies disabled

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