comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: basic basic ada question
Date: Fri, 20 Oct 2006 15:26:33 +0200
Date: 2006-10-20T15:26:33+02:00	[thread overview]
Message-ID: <12xr30p1ns0zp.h3nek7l0tnyw$.dlg@40tude.net> (raw)
In-Reply-To: ehafvt$obn$1@cernne03.cern.ch

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



  reply	other threads:[~2006-10-20 13:26 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19 14:30 basic basic ada question markww
2006-10-19 14:47 ` Georg Bauhaus
2006-10-19 15:10   ` markww
2006-10-21 10:29     ` Stephen Leake
2006-10-19 15:11 ` Dmitry A. Kazakov
2006-10-19 15:45   ` markww
2006-10-19 16:29     ` Gautier
2006-10-19 17:16     ` Dmitry A. Kazakov
2006-10-19 20:07     ` Jeffrey R. Carter
2006-10-19 22:20       ` Robert A Duff
2006-10-20  5:10         ` Jeffrey R. Carter
2006-10-20  7:13           ` Maciej Sobczak
2006-10-20 20:39             ` Jeffrey R. Carter
2006-10-20  7:25       ` Maciej Sobczak
2006-10-20 20:54         ` Jeffrey R. Carter
2006-10-19 21:30 ` James Alan Farrell
2006-10-19 23:03   ` Robert A Duff
2006-10-20  4:54   ` Jeffrey R. Carter
2006-10-20  7:53   ` Dmitry A. Kazakov
2006-10-20  8:17     ` Maciej Sobczak
2006-10-20  9:08       ` Dmitry A. Kazakov
2006-10-20 11:15         ` Maciej Sobczak
2006-10-20 12:19           ` Dmitry A. Kazakov
2006-10-20 12:38             ` Maciej Sobczak
2006-10-20 13:26               ` Dmitry A. Kazakov [this message]
2006-10-20 15:29             ` Robert A Duff
2006-10-20 17:37               ` Dmitry A. Kazakov
2006-10-20 20:59                 ` Robert A Duff
2006-10-21 13:39                   ` Dmitry A. Kazakov
2006-10-21 17:53                     ` Robert A Duff
2006-10-22  8:45                       ` Dmitry A. Kazakov
2006-10-23  7:45                     ` Maciej Sobczak
2006-10-23  9:21                       ` Dmitry A. Kazakov
2006-10-23 14:30                         ` Maciej Sobczak
2006-10-23 15:08                           ` Dmitry A. Kazakov
2006-10-23 15:49                             ` Robert A Duff
2006-10-24  7:34                               ` Dmitry A. Kazakov
2006-10-20 19:04           ` Simon Wright
2006-10-20 15:27         ` Robert A Duff
2006-10-20 17:37           ` Dmitry A. Kazakov
2006-10-20 21:00     ` Jeffrey R. Carter
2006-10-21  8:19       ` Dmitry A. Kazakov
2006-10-21 17:32         ` Robert A Duff
2006-10-22  8:45           ` Dmitry A. Kazakov
2006-10-30 11:46             ` Martin Krischik
replies disabled

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