From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Interesting effects in array renaming
Date: Tue, 24 Jun 2003 14:48:46 +0200
Date: 2003-06-24T14:48:46+02:00 [thread overview]
Message-ID: <bd9h67$qrub6$1@ID-77047.news.dfncis.de> (raw)
In-Reply-To: bd9e3h$sc$1@a1-hrz.uni-duisburg.de
Georg Bauhaus wrote:
> Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
> : That the new view is wellcome to be inconsistent does not follow from
> : that. It is written pair lines below. BTW, for tagged types it is
> : different and semantically consistent:
> :
> : procedure Foo (X : Base'Class) is
> : XX : Derived renames X; -- Illegal
> : XX : Derived renames Derived (X); -- Legal and *CHECKED*
>
> I'm not sure, considering
>
> procedure Foo (X : in out Varying'Class) is
> subtype Nono is Changeant (false);
> X1 : Changeant renames X; -- Illegal
> X2 : Nono renames Changeant(X); -- Legal and *CHECKED*
You could make it even more scandalous:
X2 : Nono renames Nono(X); -- !!!No discriminant checks!!!
> begin
> X2.messy := 2 * X2.messy;
> -- constraint_error when discriminant is true
> end Foo;
>
> where
> package Derivs is
>
> type Varying (special: Boolean)
> is
> tagged record
> comp: Natural;
> end record;
>
> type Changeant (very_special: Boolean)
> is
> new Varying(very_special) with
> record
> case very_special is
> when true =>
> another: Boolean;
> when false =>
> messy: Integer;
> end case;
> end record;
> end Derivs;
Clarification: I meant tags, not discriminants (of possibly tagged types).
What happens in your example, is the following. Nono has two constraints:
1. The discriminant very_special => False
2. The tag => Changeant'Tag (viewed as a constraint for any of the classes:
Varying'Class, Changeant'Class)
When you rename X, the constraint 2 is checked. The constraint 1 is silently
ignored as ARM requires.
Here we are. Now, convince me that it is GOOD.
--
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de
next prev parent reply other threads:[~2003-06-24 12:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-22 14:52 Interesting effects in array renaming Dmitry A. Kazakov
2003-06-22 17:24 ` Jeffrey Carter
2003-06-23 8:12 ` Dmitry A. Kazakov
2003-06-23 10:29 ` Georg Bauhaus
2003-06-23 11:37 ` Dmitry A. Kazakov
2003-06-23 13:28 ` Georg Bauhaus
2003-06-24 7:35 ` Dmitry A. Kazakov
2003-06-24 14:38 ` Georg Bauhaus
2003-06-25 10:28 ` Dmitry A. Kazakov
2003-06-25 14:23 ` Georg Bauhaus
2003-06-25 19:00 ` Dmitry A. Kazakov
2003-06-24 2:35 ` Robert I. Eachus
2003-06-24 7:35 ` Dmitry A. Kazakov
2003-06-24 10:08 ` Lutz Donnerhacke
2003-06-24 11:53 ` Georg Bauhaus
2003-06-24 12:48 ` Dmitry A. Kazakov [this message]
2003-06-26 2:54 ` Randy Brukardt
2003-06-26 6:27 ` Vinzent Hoefler
2003-06-26 12:44 ` Georg Bauhaus
2003-06-26 13:01 ` Vinzent Hoefler
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox