comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Derived private interface
Date: Thu, 07 Jul 2011 16:09:58 +0200
Date: 2011-07-07T16:09:58+02:00	[thread overview]
Message-ID: <4e15be36$0$6556$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <425f89e6-8c77-4615-a717-f6991ca63b65@v12g2000vby.googlegroups.com>

On 07.07.11 01:56, Adam Beneschan wrote:
> (3) in the complex case where
> visibility rules cause an inherited operation to disappear, then
> you'll have to figure out what's going on.  Case #3 is the difficult
> one.

Yes, and either way, I think I'll have to think about complex issues
in case #3, with or without indicators, insofar as either issue
(backwards or forwards) will point to the same things. Should
an issue arise.  But point taken, every hint from the compiler
is welcome, the better hint wins.

I guess I'm uneasy with indicators (which I use) because they
purport to solve some problem, but this is just accidental,
and ad hoc, and incomplete in several dimensions.  Maybe something
better is still possible.

If indicators are about doing Ada inheritance properly, here is
an alternative. (That's likely a bold attempt, but anyway.)
Like "overriding", it restricts the language's assistence
to just tagged types.  Instead of adding all indicators,
have the programmer explicitly mention each operation.  Let

  T0 = ({...}, {Op1, ..., OpN}),

then deriving T1 from T0 will list all operations {Op1, ..., OpN}.
(Tools will help the lazy writer.)  For N=2:

   type T0 is abstract tagged private;
   procedure Op1 (X : in out T0) is abstract;
   procedure Op2 (X : in out T0) is abstract;

Then,

   type T1 is abstract new T0 with private;
   procedure Op1 (X : in out T1) is <>;  -- abstract
   procedure Op2 (X : in out T1);  -- overriding
   procedure Op3 (X : in out T1); -- DC

   type T2 is new T1 with private;
   procedure Op1 (X : in out T2);  -- overriding
   procedure Op2 (X : in out T2) is <>; -- inheriting
   procedure Op3 (X : in out T2); -- overriding
   procedure Op4 (X : in out T2); -- DC


Remove T0's Op2. Then, T1 and T2 will have a dispatching
operation that no longer overrides their parent's.  Bad?

Add Op17 to T1. T2 will become invalid because it does
not list Op17. (Fix is to list Op17 using "is <>".)

Add Op3 to T0.  T1's Op3 then becomes overriding. Bad?

Misspelling T2's Op2 renders T2 invalid (because all names
of T1 have to be listed and Op2 will not be listed).
A call on an object of type T2 cannot "by accident"
resolve to a call on T1's.


Eiffel has something similar.  A class inheriting from other
classes will list the features (operations) that it is going
to redefine (override).



  reply	other threads:[~2011-07-07 14:09 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05  3:14 Derived private interface Rego, P.
2011-07-05  5:10 ` AdaMagica
2011-07-06  2:24   ` Rego, P.
2011-07-06  4:34   ` AdaMagica
2011-07-06  7:55     ` Georg Bauhaus
2011-07-06  8:30       ` AdaMagica
2011-07-06 12:59         ` Georg Bauhaus
2011-07-06 13:23           ` AdaMagica
2011-07-06 19:06             ` Randy Brukardt
2011-07-06 13:28           ` Simon Wright
2011-07-06 19:45           ` Randy Brukardt
2011-07-06 22:05             ` Georg Bauhaus
2011-07-06 23:56               ` Adam Beneschan
2011-07-07 14:09                 ` Georg Bauhaus [this message]
2011-07-07 15:10                   ` Adam Beneschan
2011-07-08  4:29                     ` AdaMagica
2011-07-08 19:08                       ` Randy Brukardt
2011-07-08 19:12                     ` Randy Brukardt
2011-07-07 15:19                   ` Georg Bauhaus
2011-07-07 10:37         ` Stephen Leake
2011-07-07 13:18           ` Georg Bauhaus
2011-07-08 19:23             ` Randy Brukardt
2011-07-08 21:41               ` Jeffrey Carter
2011-07-09  6:14                 ` Dmitry A. Kazakov
2011-07-22 22:59                 ` Randy Brukardt
2011-07-23  7:30                   ` Jeffrey Carter
2011-07-23  9:29                     ` Maciej Sobczak
2011-07-23 10:07                     ` Dmitry A. Kazakov
2011-07-26 21:04                     ` Randy Brukardt
2011-07-26 23:43                       ` Jeffrey Carter
2011-07-27 23:56                         ` Randy Brukardt
2011-07-28  0:18                           ` Jeffrey Carter
2011-07-28 10:06                         ` Maciej Sobczak
2011-07-28 23:24                           ` Randy Brukardt
2011-07-29  6:45                             ` Simon Wright
2011-07-30  0:04                               ` Randy Brukardt
2011-07-30  6:32                                 ` Simon Wright
2011-08-01  9:30                                   ` Alex R. Mosteo
2011-08-01 10:12                                     ` Dmitry A. Kazakov
2011-08-01 21:56                                       ` Randy Brukardt
2011-08-02 10:03                                         ` Dmitry A. Kazakov
2011-08-02 21:16                                           ` Randy Brukardt
2011-08-03  9:01                                             ` Dmitry A. Kazakov
2011-08-03 20:16                                               ` Randy Brukardt
2011-08-04  8:15                                                 ` Dmitry A. Kazakov
2011-08-09 21:10                             ` Maciej Sobczak
2011-08-09 21:35                               ` Randy Brukardt
2011-08-10  9:11                                 ` Dmitry A. Kazakov
2011-08-10 21:56                                   ` Randy Brukardt
2011-08-11  8:07                                     ` Dmitry A. Kazakov
2011-08-12  4:52                                       ` Randy Brukardt
2011-08-12  8:54                                         ` Dmitry A. Kazakov
2011-08-10 10:07                                 ` Maciej Sobczak
2011-08-10 11:26                                   ` Georg Bauhaus
2011-08-10 22:27                                     ` Randy Brukardt
2011-08-10 22:21                                   ` Randy Brukardt
2011-08-11 13:50                                     ` Maciej Sobczak
2011-08-12  4:43                                       ` Randy Brukardt
2011-08-12  7:00                                         ` Maciej Sobczak
2011-08-12 21:59                                           ` Randy Brukardt
2011-07-06 15:06       ` Adam Beneschan
2011-07-06 16:36       ` Dmitry A. Kazakov
2011-07-06 19:20       ` Randy Brukardt
replies disabled

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