comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Derived private interface
Date: Thu, 7 Jul 2011 08:10:33 -0700 (PDT)
Date: 2011-07-07T08:10:33-07:00	[thread overview]
Message-ID: <1c98072b-e5b9-43dd-9fde-f6687086deef@w24g2000yqw.googlegroups.com> (raw)
In-Reply-To: 4e15be36$0$6556$9b4e6d93@newsspool4.arcor-online.net

On Jul 7, 7:09 am, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
wrote:

> 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.

I think you're right that this was an ad hoc solution to an unforeseen
problem, and that there may have been better ways to do this back in
Ada 95 if the team had realized the potential problems.  On the other
hand, I'm not all that uneasy with it because I realize that if we
waited to make sure that everything was perfect, the first version of
Ada would have been Ada 2317 or something like that, and we would have
been stuck with C until then.

Your idea below seems sensible, but it's not backward-compatible; if
it were added to the next version of Ada, a lot of legal programs
would become illegal, and that's something the designers try to
avoid.  Perhaps there's a solution involving aspect clauses---since
they're new, it would be easier to make them backward-compatible.  One
idea off the top of my head:

   type T1 is new T0 with record ... end record
       with inherit => (Op1, Op3), override => (Op2, Op4);

(Aspect specifications don't currently allow lists of identifiers, but
this could probably be changed compatibly.)  Then the type declaration
would be illegal if T0 has a primitive operation that isn't listed in
either list, if an operation is listed that isn't a primitive
operation of T0, if there is a conflicting declaration for something
in the "inherit" list, or there is no overriding declaration for
something in the "override" list.  This is just a first attempt, and
it definitely won't work because it doesn't deal with overloaded names
and there are probably problems with private parts.

But maybe we could implement your idea and still make things backward
compatible:

   type T1 is new T0 with record ... end record
      with Georgs_Rules;

Then if the "with Georgs_Rules" is present, the operation declarations
would have to follow your rules, and if it isn't, they'd follow the
old rules.  Then GNAT would add an option that would cause the
compiler to reject any type extension without this aspect clause.
(Somebody else would have to come up with a better name for this
aspect.)

I'm just brainstorming here; I don't have any idea whether a feature
like this would be worthwhile, particularly since it could cause the
language rules to become somewhat messy.

                                   -- Adam



  reply	other threads:[~2011-07-07 15:10 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
2011-07-07 15:10                   ` Adam Beneschan [this message]
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