comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Discriminants of tagged types
Date: Wed, 27 Oct 2010 12:06:52 -0400
Date: 2010-10-27T12:06:52-04:00	[thread overview]
Message-ID: <wcczktzliw3.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: a78d88bb-e202-49d5-a9fe-f38206efd4ea@j18g2000yqd.googlegroups.com

Maciej Sobczak <see.my.homepage@gmail.com> writes:

> In the mean time I have solved the problem by realizing that
> "taggedness" need not be public - in my case the type was tagged,
> because it was controlled (hate to repeat it, but the interaction
> between these two unrelated language features is really annoying).
> I don't have to expose the controlled nature of the type in the public
> view and moved the "tagged" keyword to private part.
> Interestingly, this allowed me to use default values for discriminants
> *and* have the controlled type.

That doesn't sound right.  What does your example look like,
and what compiler compiled it without error?

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;

 6 lines: 1 error

> (and this also shows that your explanation for why it cannot work is
> shaky ;-) )

Well, it would if it were true.  ;-)

> (except that now the "distinguished receiver" notation is gone...)

I'm not a big fan of that notation.  An awful lot of compiler
work for a little bit of syntactic sugar (or maybe syntactic
salt).

- Bob



  parent reply	other threads:[~2010-10-27 16:06 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 [this message]
2010-10-27 16:34       ` Yannick Duchêne (Hibou57)
2010-10-27 21:05       ` Maciej Sobczak
2010-10-28  0:35         ` Robert A Duff
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