comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada Distilled by Richard Riehle
Date: Sat, 28 Jul 2018 09:12:49 +0200
Date: 2018-07-28T09:12:49+02:00	[thread overview]
Message-ID: <pjh51i$8im$2@gioia.aioe.org> (raw)
In-Reply-To: 8d3444a9-0865-4a7b-8377-0027d20d74f1@googlegroups.com

On 2018-07-28 05:52, Dan'l Miller wrote:
> On Friday, July 27, 2018 at 3:07:21 PM UTC-5, Dmitry A. Kazakov wrote:

>> Set-theoretic operations have only limited interest.
> 
> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.51.200&rep=rep1&type=pdf
> I disagree.  From 2 decades ago, Holzmüller & Plödereder seem to find quite a fascinating use for one set-theoretic operation in particular:  union/conjunction as the basis for openmultimethods dispatched more like PL/I generics (dispatched on subprograms by curated type) than Ada95/C++ single-dispatch OO (i.e., dispatched on types by curated subprogram).

Ad-hoc supertype would do that job. Instead of building a class by 
specifying its members:

    type T is union (T1, T2, T3);

as authors propose, we could simply declare a common ancestor:

    type Semantics_Interface is ...
    procedure Eval (X : in out Semantics_Interface) is abstract;

for all tree types.

Then for each type we create a supertype that also inherits from 
Semantics_Interface. Doing so we will be required to override Eval.

Now all three types are in the same class Semantics_Interface'Class and 
we can dispatch on Eval on class-wide instances from 
Semantics_Interface'Class.

The advantage of this approach is that it is still inheritance, nothing 
new, just Ada OO model. Another important advantage is that members of 
the ad-hoc class need not to be all known in advance. We can add members 
as needed in separate packages.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2018-07-28  7:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15 18:09 Ada Distilled by Richard Riehle rabbibotton
2018-07-16  1:02 ` Shark8
2018-07-21  6:07   ` Randy Brukardt
2018-07-26  0:42     ` rabbibotton
2018-07-26 20:17       ` Shark8
2018-07-26 21:10         ` Jeffrey R. Carter
2018-07-27  3:01           ` Paul Rubin
2018-07-27 14:32           ` rabbibotton
2018-07-27 20:18             ` Paul Rubin
2018-07-27 17:02           ` Shark8
2018-07-27 14:30         ` rabbibotton
2018-07-27 17:11           ` Shark8
2018-07-27 18:52             ` Dan'l Miller
2018-07-27 20:07               ` Dmitry A. Kazakov
2018-07-27 20:38                 ` Dan'l Miller
2018-07-27 21:32                   ` Dmitry A. Kazakov
2018-07-28  2:41                     ` Dan'l Miller
2018-07-28  7:10                       ` Dmitry A. Kazakov
2018-07-28 15:01                         ` Dan'l Miller
2018-07-28 15:41                           ` Dmitry A. Kazakov
2018-07-28 16:05                             ` Dan'l Miller
2018-08-06 19:33                             ` Vincent
2018-08-06 22:01                               ` Dmitry A. Kazakov
2021-12-09 11:13                                 ` Kevin Chadwick
2018-07-27 21:34                 ` Shark8
2018-07-27 22:16                   ` Dmitry A. Kazakov
2018-07-28  3:52                 ` Dan'l Miller
2018-07-28  7:12                   ` Dmitry A. Kazakov [this message]
2018-07-27 20:35               ` Paul Rubin
replies disabled

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