From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Extension of non-limited type needs limited component
Date: Sat, 16 Nov 2002 13:39:15 +0100
Date: 2002-11-16T13:39:15+01:00 [thread overview]
Message-ID: <ar5ea7$f94ic$1@ID-77047.news.dfncis.de> (raw)
In-Reply-To: wccbs4q8oys.fsf@shell01.TheWorld.com
Robert A Duff wrote:
> Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:
>
>> In an OO language like Ada 95 is, "limited" makes little sense,
>> because it covers only one of many useful alternatives.
>
> But non-limited/limited does not just mean assignment
> allowed/disallowed. How do you propose to deal with all the other
> things controlled by this distinction? For example:
>
> Non-limited types can have unconstrained aliased components; limited
> types cannot.
>
> Limited types can have access discriminants; non-limited types
> cannot.
>
> Limited types can have limited components (like tasks and protected
> objects); non-limited types cannot.
>
> The current instance of a limited type is aliased, so you can say
> "T'Unchecked_Access" inside type T, to make a pointer to the current
> object of type T. You can't do that for non-limited.
>
> (Most) limited types are guaranteed to be passed by reference;
> that's not true for non-limited.
>
> A function can construct a new object of a non-limited type, and
> return it. You can't do that for (most) limited types.
All that are more or less decoupled things. Why should we tie all of them
under one roof?
> The point is that there are some things you can do for limited that you
> can't do for non-limited, and vice-versa, so neither is a subset of the
> other. Therefore, you can't derive a limited type from a non-limited
> type, nor vice-versa.
>
> By the way, have you read the AARM annotations that explain why we
> didn't allow user-defined ":=" procedures?
Yes, however it was some 2 years ago, so will re-read it again.
> We certainly wanted to,
> but we couldn't figure out how to make it work, so we invented Adjust,
> which is not as powerful. I'd be interested in hearing better ideas
> (even though it's probably too late).
I think that Adjust maybe is just fine. The actual problem is an attempt to
hide everything from the programmer. Copy+Adjust is a copy constructor,
fine, but why ":=" should be *always* generated out of it? In my view there
should be a way to decouple them, i.e. to get rid of the predefined ":=",
and to define a new one. If a programmer does it, it is now his
responsibility to ensure that the semantics of ":=" be better close to
Copy+Adjust. To diminish the consequent mess with inheritance of ":=", one
could say that if the right parameter is not class-wide, then it is
covariant, so ":=" has to be either overridden or else disallowed in any
derived type. [However, I am afraid, that to correctly deal with it one
would need multiple dispatch anyway.]
--
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de
next prev parent reply other threads:[~2002-11-16 12:39 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-13 10:03 Extension of non-limited type needs limited component Mike
2002-11-13 12:06 ` Jean-Pierre Rosen
2002-11-14 9:26 ` Mike
2002-11-14 11:43 ` David C. Hoos, Sr.
2002-11-14 12:33 ` Jean-Pierre Rosen
2002-11-14 14:27 ` Dmitry A. Kazakov
2002-11-14 19:25 ` Randy Brukardt
2002-11-15 10:04 ` Dmitry A. Kazakov
2002-11-15 22:09 ` Robert A Duff
2002-11-16 12:39 ` Dmitry A. Kazakov [this message]
2002-11-16 16:15 ` Robert A Duff
2002-11-17 11:14 ` Dmitry A. Kazakov
2002-11-17 12:26 ` Dale Stanbrough
2002-11-18 20:33 ` Randy Brukardt
2002-11-18 21:48 ` Eric
2002-11-19 14:38 ` Eric
2002-11-15 21:41 ` Robert A Duff
2002-11-16 3:54 ` Randy Brukardt
2002-11-15 0:30 ` Robert A Duff
2002-11-15 10:22 ` Dmitry A. Kazakov
2002-11-15 21:56 ` Robert A Duff
2002-11-16 12:39 ` Dmitry A. Kazakov
2002-11-14 23:39 ` Robert A Duff
2002-11-15 21:51 ` Mike
2002-11-13 14:28 ` Robert A Duff
2002-11-14 9:33 ` Mike
2002-11-14 9:35 ` Lutz Donnerhacke
2002-11-14 21:41 ` Robert A Duff
-- strict thread matches above, loose matches on Subject: below --
2002-11-15 10:47 Grein, Christoph
2002-11-15 12:12 ` Dmitry A. Kazakov
2002-11-15 13:29 ` Jean-Pierre Rosen
2002-11-15 14:34 ` Dmitry A. Kazakov
2002-11-15 21:26 ` 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