comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: MI for Ada
Date: 1999/02/14
Date: 1999-02-14T00:00:00+00:00	[thread overview]
Message-ID: <7a7aav$mse$2@plug.news.pipex.net> (raw)
In-Reply-To: 7a2j8q$meo@bgtnsc01.worldnet.att.net

Alexy V Khrabrov wrote in message <7a2j8q$meo@bgtnsc01.worldnet.att.net>...
|
|Robert I. Eachus wrote [an unspeakable blasphemy in 1983] in his message:
|
|>  It would be a very useful extension to the language.  Any one want
|>to work out the details of the semantics, then add it to gnat as a
|>language extension?  I suspect that taking it that far is not too much


A blasphemy in 1983 perhaps, but not such a blasphemy now. Provided the
extended syntax is rejected when the compiler is in 'standard mode', and
accepted in some special mode (probably activated by a compiler flag), the
sacred snake remains in his lair.

Actually, it occurs to me that there is no particular difficulty in
providing multiple inheritance from several publicly null-record tagged
types at the same time. The new type would have to implement all the
promised subprograms of both/all its parents, and (probably) it would have
to be illegal for any such subprograms to 'overlap' (have same name &
profile). Class membership tests for such types could be implemented by
chaining the descriptors in series (the user would never know).

For example:

   package Pa is
      type Ta is abstract tagged null record;
      function F1 (X: in Ta) return Ta is abstract;
   end Pa;

   package Pb is
      type Tb is abstract tagged null record;
      function F2 (X: in Tb) return Tb is abstract;
   end Pa;

   package Pc is
      type Tc is new Ta, Tb with private;
      function F1 (X: in Tc) return Tc;
      function F2 (X: in Tc) return Tc;
   private
      ...
   end Pc;

The last type declaration would really just be a convenient way of writing

       type anon is new Ta with null record;
       function F2 (X: in anon) return anon is abstract;
       type Tc is new anon with private;

or equally

       type anon is new Tb with null record;
       function F1 (X: in anon) return anon is abstract;
       type Tc is new anon with private;

but I think it's clear that this could be a facility that would be very
convenient at times.

There would be a difference, in that both "X in Ta'Class" and "X in
Tb'Class" would be true, if X were of type Tc. This functionality could be
implemented by making a copy of the descriptor (the vector table) for Ta,
and parent-linking this vector table to Tb, and then Tc's descriptor to this
special copy of Ta's. You would have to store a tag value in each descriptor
(rather than using the address of the descriptor as the tag).

I suspect this is stuff that the Ada 95 design people went over (a lot).

Something for Ada 200X, perhaps?

-------------------------------------------
Nick Roberts

The meek shall inherit the Earth. And then
pay the capital transfer tax on it in full.
-------------------------------------------









  reply	other threads:[~1999-02-14  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-11  0:00 MI for Ada Brian Rogoff
1999-02-11  0:00 ` Tucker Taft
1999-02-12  0:00   ` Robert I. Eachus
1999-02-12  0:00     ` Brian Rogoff
1999-02-13  0:00     ` Alexy V Khrabrov
1999-02-14  0:00       ` Nick Roberts [this message]
1999-02-15  0:00         ` robert_dewar
1999-02-18  0:00           ` Nick Roberts
1999-02-16  0:00         ` Robert I. Eachus
1999-02-16  0:00           ` robert_dewar
1999-02-16  0:00             ` Robert I. Eachus
1999-02-17  0:00           ` Brian Rogoff
replies disabled

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