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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada Distilled by Richard Riehle Date: Sat, 28 Jul 2018 09:12:49 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <72ccb7fa-a9cb-42e6-8c29-3c06da281a45@googlegroups.com> <2212eb54-cb4a-446f-9cdf-287ef220e2c2@googlegroups.com> <1b5a58b2-65b7-4df8-80b5-03e208d249e1@googlegroups.com> <8d3444a9-0865-4a7b-8377-0027d20d74f1@googlegroups.com> NNTP-Posting-Host: IzvqdhUtDGKIMCldyDtZ+w.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:53998 Date: 2018-07-28T09:12:49+02:00 List-Id: 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