comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Extension of non-limited type needs limited component
Date: Fri, 15 Nov 2002 11:22:50 +0100
Date: 2002-11-15T11:22:50+01:00	[thread overview]
Message-ID: <gmh9tusk16le4p3s31c51r6al8pjbspb8n@4ax.com> (raw)
In-Reply-To: wccel9nhdys.fsf@shell01.TheWorld.com

On Fri, 15 Nov 2002 00:30:03 GMT, Robert A Duff
<bobduff@shell01.TheWorld.com> wrote:

>Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> writes:
>
>> Which also raises an interesting question, whether T'Class should
>> always inherit "non-limitness" of T. Or more generally shouldn't one
>> have an ability to disallow primitive operations (like ":=" in case of
>> non-limited->limited mutation)?
>> 
>> Let we allow disallowing, then either
>> 
>> 1. ":=" should dispatch in X:=Y to a disallowed operation, thus raise
>> an exception and so refuse to copy the limited components.
>
>Compile time errors are good.  Exceptions (run-time errors) are evil.

Absolutely

>This is not SmallTalk, where you can dispatch to a method that does not
>exist.

Sure? And what about this:

type A is tagged ...
procedure Foo (L, R : A);

type B is new A with ....

X : A'Class := Some_A;
Y : A'Class := Some_B;

Foo (X, Y); -- Oops, dispatching to nowhere!

[ Not that I argue for SmallTalk, of course (:-)) ]

Then disallowing is already allowed for non-tagged types =
"is abstract". 

Further one can always override with a subroutine that throws
Program_Error. Is that better? IMO it is the same. The only real
difference is that one cannot get rid of overloading of the undesired
operation. What is actually required. I think that there could be
situations where it would be useful to disallow an operation in the
public interface and to override it with something working in the
private one.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2002-11-15 10:22 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
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 [this message]
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