comp.lang.ada
 help / color / mirror / Atom feed
From: "Adam Beneschan" <adam@irvine.com>
Subject: Re: Limited_Controlled, orthogonality and related issues
Date: 19 Jan 2007 09:04:57 -0800
Date: 2007-01-19T09:04:57-08:00	[thread overview]
Message-ID: <1169226297.096612.106410@q2g2000cwa.googlegroups.com> (raw)
In-Reply-To: wbk3791avbo3$.dnhsyn339lcz.dlg@40tude.net

Dmitry A. Kazakov wrote:

> > On reflection, maybe there *is* a way to fix this: Change the first
> > sentence of 3.9.2(1) to read, "The primitive subprograms of a tagged
> > type are called dispatching operations, except that a primitive
> > subprogram of two or more tagged types is not a dispatching operation
> > if it is declared in the visible part of a package, and every type of
> > which the subprogram is a primitive operation is an untagged type or a
> > tagged type whose partial view is untagged".  Or something along those
> > lines.  The idea is that a change like this would have no effect on
> > programs that are currently legal, so it seems like it should be safe.
> > And it would make programs like Maciej's original attempt legal, as
> > they (IMHO) should be.
>
> I think that this idea is wrong because it fixes broken public view
> [non-tagged but dispatching], by breaking the private view [non-dispatching
> but tagged].

It's certainly a "hack" solution that would introduce an inconsistency
into the language, but that certainly wouldn't be the first time
something inconsistent was added to Ada, in order to try to fix a
problem while having minimal effect on existing programs.  Unless I've
missed something, the hack solution I proposed would affect *only*
programs that are currently illegal while having no effect on the
semantics of currently legal programs, so from that standpoint I don't
see how it "breaks" anything.

However, now that I've seen Randy's post, I'm convinced that there are
less onerous ways to get around the problem---you can arrange things so
that you can declare this subprogram and still implement the full views
of the types any way you wish.  So there's probably less of a reason to
add a "hack" like this to the language than there was when I first
posted it.

I think that your idea below is possibly a good reflection of how
things *should* have been designed, in theory; but I think it could
break existing programs if we tried to add that now.  I'm afraid that
not enough consideration was given to the special problems of untagged
private types whose full view is tagged when Ada 95 was designed; as I
recall, I've found areas of the RM that were worded in a way that made
it unclear what should happen with such types.

                                -- Adam


> I think that the guiding rule should be that all views of the
> same thing shall be consistent. For this reason it would be better that for
> such subprograms the private view of such subprograms were class-wide:
>
> package
>    type T is limited private;
>    procedure Foo (X : in out T);
> private
>    type T is new Ada.Finalization.Limited_Controlled with ...;
> --
> -- Here Foo is seen as
> --
> --    procedure Foo (X : in out T'Class);




  reply	other threads:[~2007-01-19 17:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18  9:24 Limited_Controlled, orthogonality and related issues Maciej Sobczak
2007-01-18 12:00 ` Ludovic Brenta
2007-01-18 12:33   ` AW: " Grein, Christoph (Fa. ESG)
2007-01-18 16:25   ` Robert A Duff
2007-01-18 17:02 ` Adam Beneschan
2007-01-18 17:16   ` Adam Beneschan
2007-01-19  1:02     ` Robert A Duff
2007-01-19  7:38       ` Maciej Sobczak
2007-01-19  9:05     ` Dmitry A. Kazakov
2007-01-19 17:04       ` Adam Beneschan [this message]
2007-01-19  1:01   ` Robert A Duff
2007-01-19  9:57   ` Stephen Leake
2007-01-18 19:03 ` Jeffrey Carter
2007-01-19  7:48 ` Randy Brukardt
2007-01-19 16:46   ` Adam Beneschan
2007-01-19 15:29 ` Robert A Duff
2007-01-19 16:31   ` Dmitry A. Kazakov
2007-01-19 16:36     ` Robert A Duff
2007-01-19 18:26       ` Dmitry A. Kazakov
2007-01-19 20:17         ` Robert A Duff
2007-01-20 10:14           ` Dmitry A. Kazakov
2007-01-20 14:44             ` Robert A Duff
replies disabled

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