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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,782af4edeb84c4b7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: basic basic ada question Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1161268231.345231.242170@m73g2000cwd.googlegroups.com> <4537bc65_1@newsfeed.slurp.net> <5567b72ia0c9$.1b6yl0tpfscj5$.dlg@40tude.net> Date: Fri, 20 Oct 2006 15:26:33 +0200 Message-ID: <12xr30p1ns0zp.h3nek7l0tnyw$.dlg@40tude.net> NNTP-Posting-Date: 20 Oct 2006 15:26:33 CEST NNTP-Posting-Host: 1be7e867.newsspool4.arcor-online.net X-Trace: DXC=aeoFF9=Fh>FE4ZB2flKORA4IUK?>CcE2HNA X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7078 Date: 2006-10-20T15:26:33+02:00 List-Id: On Fri, 20 Oct 2006 14:38:21 +0200, Maciej Sobczak wrote: > Dmitry A. Kazakov wrote: > >> Indexing operation (BTW, aggregates, ".", X'Attribute, "in", ".all" >> too) should be primitive. The problem is that one cannot to it right >> without 1) MD, 2) a proper construction model, 3) a more elaborated >> subroutine extension mechanics than just inherit vs. replace. > > What's MD and what is really needed for 3)? MD = multiple dispatch. I assumed the obvious: all types have to have classes and almost all public operations should be either primitive or class-wide. For 3 there should be some sane way to bring together class-wide and primitive (dispatching) operations. The most notorious case is represented by constructors and destructors (and aggregates too). Clearly, if there existed a solution for constructors, then exactly the same technique could be exposed to all other subprograms. Dispatch upon construction is seemingly necessary and re-dispatch obviously contradicts to the requirement "classes for all." This IMO means that there should be a mixture of class-wide and primitive parts of the body of some "hyper-primitive" (:-)) subprogram defined on the class. Basically you have three "quarks": Q1. The things you wish to enforce on the base type (defined on Base_Type) Q2. The things specific to the base type (defined on Base_Type) Q3. The things you wish to enforce on all derived types (defined on Base_Type'Class) Q1 is a classic extension as found in C++ constructors; Q2 can be overridden/inherited; Q3 is some class-wide part from which one can dispatch on already constructed object. More precisely Q3 acts on the polymorphic object which invariant is true. Q1 and Q2 maintain the invariants of specific types. For destructors the order is reverse Q3-Q2-Q1. For other operations it might be Q1-Q2-Q3-Q2'-Q1'. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de