From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Discriminants of tagged types
Date: Wed, 27 Oct 2010 20:35:44 -0400
Date: 2010-10-27T20:35:44-04:00 [thread overview]
Message-ID: <wcchbg7nogv.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 989c6412-8dbf-403c-9ce0-766e0e953fb6@u17g2000yqi.googlegroups.com
Maciej Sobczak <see.my.homepage@gmail.com> writes:
>> The latest GNAT says:
>>
>> � � �1. with Ada.Finalization; use Ada.Finalization;
>> � � �2. package Eg is
>> � � �3. � �type T (X: Boolean := False) is private;
>> � � �4. private
>> � � �5. � �type T (X: Boolean := False) is new Controlled with null
>> � � �record;
>> � � � � � � � � � � � � � � � � �|
>> � � � � >>> discriminants of tagged type cannot have defaults
>>
>> � � �6. end Eg;
>
> My compiler eats this stuff without even blinking. It complains only
> when I add the "tagged" keyword in line 3, between "is" and "private".
OK, well then it's a compiler bug that has since been fixed.
Now that I think about it, I think I remember a recent bug
in this area.
I'll bet if you tried hard enough, you'd find some cases
where the compiler generated code that did strange things
(before the bug was fixed, I mean).
> Protected objects, tasks and records already supported it.
Records never supported this notation for calls,
which I thought was what we're talking about.
I wasn't a big fan of it for tasks or protected objects, either.
But at least for these things, a "distinguished receiver" does
make sense, because there's only one object getting locked.
And because inside the operation, you can only see inside that
one object. That is, in X.Y(Z), X is special in the
protected object case, but X and Z are just normal parameters
in the normal tagged case.
>... It is not a
> new idea, so it wasn't that big deal for compiler writers, I guess.
Well, it was. Maybe it wouldn't have been if this new syntax
had been invented in the first place, but adding this sort
of thing into an existing compiler can be quite a pain.
> I treat it as a unification of syntax across these similar features -
> quite a valid goal in language design.
>
> This is especially reasonable if you take into account that in Ada
> 2005 protected types can derive from interfaces. It would be very
> inconsistent not to allow the same calling syntax across the whole
> hierarchy, including the class-wide type.
Good point. But I'd prefer to unify the syntax in the
other direction.
- Bob
next prev parent reply other threads:[~2010-10-28 0:35 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 12:16 Discriminants of tagged types Maciej Sobczak
2010-10-27 12:34 ` Ludovic Brenta
2010-10-27 13:19 ` Dmitry A. Kazakov
2010-10-27 13:52 ` Robert A Duff
2010-10-27 14:12 ` Dmitry A. Kazakov
2010-10-27 13:44 ` Robert A Duff
2010-10-27 15:06 ` Adam Beneschan
2010-10-27 15:58 ` Yannick Duchêne (Hibou57)
2010-10-27 16:35 ` Vinzent Hoefler
2010-10-27 17:58 ` J-P. Rosen
2010-10-27 20:18 ` Yannick Duchêne (Hibou57)
2010-10-27 20:26 ` Adam Beneschan
2010-10-27 22:07 ` Yannick Duchêne (Hibou57)
2010-10-27 22:42 ` Adam Beneschan
2010-10-27 15:13 ` Maciej Sobczak
2010-10-27 16:02 ` Yannick Duchêne (Hibou57)
2010-10-27 21:13 ` Maciej Sobczak
2010-10-27 21:23 ` Ludovic Brenta
2010-10-28 8:38 ` Maciej Sobczak
2010-10-27 21:25 ` Vinzent Hoefler
2010-10-28 7:53 ` Dmitry A. Kazakov
2010-10-28 8:50 ` Maciej Sobczak
2010-10-28 10:28 ` Dmitry A. Kazakov
2010-10-28 17:48 ` Yannick Duchêne (Hibou57)
2010-10-29 18:59 ` Vinzent Hoefler
2010-10-30 21:05 ` Maciej Sobczak
2010-10-30 21:21 ` Vinzent Hoefler
2010-10-30 22:01 ` Yannick Duchêne (Hibou57)
2010-10-31 16:20 ` Maciej Sobczak
2010-10-31 17:04 ` Yannick Duchêne (Hibou57)
2010-10-31 18:36 ` Shark8
2010-10-31 21:06 ` Maciej Sobczak
2010-11-01 0:44 ` Shark8
2010-11-01 9:41 ` Maciej Sobczak
2010-10-27 16:06 ` Robert A Duff
2010-10-27 16:34 ` Yannick Duchêne (Hibou57)
2010-10-27 21:05 ` Maciej Sobczak
2010-10-28 0:35 ` Robert A Duff [this message]
2010-10-28 8:55 ` Maciej Sobczak
2010-10-27 21:28 ` Simon Wright
2010-10-27 13:54 ` J-P. Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox