comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Carey <research@ijs.co.nz>
Subject: Re: Suggestion for Ada 200x - Interface inheritance
Date: Sun, 01 Jun 2003 22:29:21 +1200
Date: 2003-06-01T22:29:21+12:00	[thread overview]
Message-ID: <l1kjdv8q5k3150ma8g483n4nrqhcjog5h4@4ax.com> (raw)
In-Reply-To: wcc3cj5i2cd.fsf@shell01.TheWorld.com

On 23 May 2003 21:02:26 -0400, Robert A Duff <bobduff@shell01.TheWorld.com> wrote:

>"Steve" <nospam_steved94@attbi.com> writes:
>
>> Java and C# use the concept of interface inheritance.  What do you think of
>> adding this feature to Ada?
>
>I think it's a good idea.  There is an AI on this, and I think the ARG
>is considering it one of the most urgent ones.  Look up the AI, and see
>what you think.
>

http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00251.TXT

The AI contains this comment:

: ****************************************************************
:
: From: Randy Brukardt
: Sent: Monday, December 04, 2000 10:31 PM
...
: I note that the proposal never seems to state that abstract interface
: types must not define any components. Certainly, the implementation
: model and the entire discussion seem to assume that is the case. (An
: "normal" abstract type can have components defined, they'll be part of
: any extension; but I don't think we want that here.)
:
: ****************************************************************


There seems to be inherent safety in avoiding O.O. and using subrecords.

So... Mulitple Inheritance is doing something like making the parent
record be subrecords of the new derived type.

If the aim is flatten out subrecords so that fields names can conflict
and fields can be accidentally not correctly set to a value, then 
the flattening could be made explicit with a way to rename Ada types.

Here is an example showing variable X holding 4 integers. Due to the
renaming of types, the 1st Integer is identified with the name
   X.A
instead of:
   X.R1.A

A sample extension of Ada:
------------------------------------------------------------------------
type T1 is
   tagged record
      A, B : Integer;
   end record;

type T2 is
   tagged record
      B, C : Integer;
   end record;

type Mixin is
   tagged record
      R1 : <> renames T1;     --  Flatten T1's fields into Mixin record
      R2 : T2;
   end record;

type Mixin renames Mixin.T2;  --  Flatten T2's fields into Mixin record

X  : Mixin := Mixin'(A => 1, R1.B => 2, R2.B => 3, C => 4);

------------------------------------------------------------------------

I regard the idea of X'Class as a way to make it easy to unintentionally
leave fields not-assigned-to. It would be harder to make that mistake
when there are subrecords. The "MI" gain of shifting fields of a
subrecord into the surrounding containing record must be quite slight
if renaming has made it look like that has occurred when it actually
hadn't.


Craig Carey
   http://www.ijs.co.nz/ada_95.htm





  parent reply	other threads:[~2003-06-01 10:29 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-23 23:05 Suggestion for Ada 200x - Interface inheritance Steve
2003-05-24  1:02 ` Robert A Duff
2003-05-29 16:47   ` Brian Gaffney
2003-06-01 10:29   ` Craig Carey [this message]
2003-05-24 12:35 ` Wojtek Narczynski
2003-05-24 17:53   ` Georg Bauhaus
2003-05-25 13:11     ` Wojtek Narczynski
2003-05-24 22:07   ` Robert A Duff
2003-05-25 14:12     ` Wojtek Narczynski
2003-05-25 17:53       ` Jeffrey Carter
2003-05-25 18:47         ` Wesley Groleau
2003-05-25 19:42           ` Hyman Rosen
2003-05-26  7:53             ` Wojtek Narczynski
2003-05-26 15:50               ` Hyman Rosen
2003-05-27 18:41                 ` Wojtek Narczynski
2003-05-27 18:55                   ` Wesley Groleau
2003-05-27 19:13                   ` Hyman Rosen
2003-05-28 13:07                     ` Wojtek Narczynski
2003-05-28 13:28                       ` Jean-Pierre Rosen
2003-05-29  0:58                       ` Hyman Rosen
2003-05-28 22:13             ` Robert A Duff
2003-05-28 23:50               ` Hyman Rosen
2003-05-29  9:17               ` Dmitry A. Kazakov
2003-05-29 13:31               ` Wojtek Narczynski
2003-05-26  7:51           ` Wojtek Narczynski
2003-05-25  1:33   ` Steve
2003-05-25 10:37     ` Simon Wright
2003-05-26  7:54     ` Jean-Pierre Rosen
2003-05-26 10:07       ` Preben Randhol
2003-05-26 16:32         ` Pascal Obry
2003-05-26 16:59           ` Preben Randhol
2003-06-01 10:53       ` Craig Carey
2003-06-01 12:17         ` Preben Randhol
2003-05-26  7:49   ` Jean-Pierre Rosen
2003-06-02  9:01     ` Wojtek Narczynski
2003-05-28 13:57 ` MI in Ada 200X (was: Suggestion for Ada 200x - Interface inheritance) Mário Amado Alves
2003-05-28 15:05   ` Preben Randhol
2003-05-29  0:54     ` MI in Ada 200X Hyman Rosen
2003-05-29 17:38       ` Stephen Leake
2003-05-30  7:20       ` Preben Randhol
2003-05-29  9:17     ` MI in Ada 200X (was: Suggestion for Ada 200x - Interface inheritance) Dmitry A. Kazakov
2003-05-29 22:56       ` MI in Ada 200X Hyman Rosen
2003-05-30  7:39         ` Dmitry A. Kazakov
2003-05-30 13:11           ` Hyman Rosen
2003-05-30 14:29             ` Robert A Duff
2003-05-30 14:51               ` Hyman Rosen
2003-05-30 15:11         ` Mark A. Biggar
2003-05-30 15:51           ` Hyman Rosen
2003-05-30 22:38           ` John Griffiths
2003-05-30  2:50       ` Wesley Groleau
2003-05-30  7:38         ` Dmitry A. Kazakov
2003-05-30 12:20           ` Karel Miklav
2003-05-30 12:59             ` Hyman Rosen
2003-05-30 14:02               ` Georg Bauhaus
2003-05-30 14:04                 ` Lutz Donnerhacke
2003-05-30 18:45                   ` Georg Bauhaus
2003-05-30 15:02                 ` Hyman Rosen
2003-05-30 19:14                   ` Georg Bauhaus
2003-05-30 19:40                     ` Hyman Rosen
2003-05-30 19:31               ` Wojtek Narczynski
2003-05-30 22:42             ` John Griffiths
2003-05-31  9:27             ` Dmitry A. Kazakov
2003-05-31 13:53               ` Martin Krischik
2003-06-01  9:18                 ` Dmitry A. Kazakov
2003-05-30  8:28         ` Mário Amado Alves
2003-05-30  8:46       ` MI in Ada 200X (was: Suggestion for Ada 200x - Interface inheritance) Preben Randhol
2003-05-31 10:17         ` Dmitry A. Kazakov
2003-05-31 13:48           ` Preben Randhol
2003-05-31 17:21             ` Dmitry A. Kazakov
2003-05-29  0:54   ` MI in Ada 200X Hyman Rosen
2003-05-29  2:13   ` MI in Ada 200X (was: Suggestion for Ada 200x - Interface inheritance) Robert I. Eachus
2003-05-29 12:06     ` Mário Amado Alves
2003-05-31 19:58       ` Chad R. Meiners
  -- strict thread matches above, loose matches on Subject: below --
2003-06-02 15:57 Suggestion for Ada 200x - Interface inheritance Lionel.DRAGHI
2003-06-02 18:58 ` Pascal Obry
2003-06-02 19:27 ` Bill Findlay
2003-06-03 17:33 Lionel.DRAGHI
2003-06-03 17:46 ` Vinzent Hoefler
2003-06-03 18:49   ` Bill Findlay
2003-06-03 19:02     ` Vinzent Hoefler
2003-06-03 19:13     ` Vinzent Hoefler
2003-06-03 17:38 Lionel.DRAGHI
2003-06-03 17:47 ` Preben Randhol
2003-06-03 17:48 ` Vinzent Hoefler
2003-06-04 16:22 Lionel.DRAGHI
replies disabled

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