comp.lang.ada
 help / color / mirror / Atom feed
From: "Hibou57 (Yannick Duchêne)" <yannick_duchene@yahoo.fr>
Subject: Re: Generic package parameters not externally visible : what's the rational ?
Date: Tue, 27 Oct 2009 15:03:10 -0700 (PDT)
Date: 2009-10-27T15:03:10-07:00	[thread overview]
Message-ID: <3084820f-4799-4555-b309-92c8ff7e2436@m16g2000yqc.googlegroups.com> (raw)
In-Reply-To: hc7p47$pn7$1@news.tornevall.net

On 27 oct, 22:36, "Jeffrey R. Carter" <spam.jrcarter....@spam.acm.org>
wrote:
> One possible rationale is:
>
> In order to reference the generic parameters from the instance, you have to have
> visibility of the instantiation. If you have visibility of the instantiation,
> then you have visibility of the generic actual parameters used in the
> instantiation. Therefore, you do not need visibility of the generic parameters
> from the instance, so why complicate the language by providing it?

After that, I will then try to give a view of the other hand :

One good reason to miss it, is when a package A has another package B
in its formal parameters and this formal package parameter (B) is it
self generic, and A needs to use some type which were given to
instantiate the package B. This is an example case where the parameter
which were used to instantiate a package, are not accessible from a
point they are needed (if P instantiated B, of course P has access to
parameters used to instantiate B, but this does not help A, it if ever
itself also need these).

More about this latter point : it may be possible, to just give to A,
the same type, but if A has let say, two of three package in its
formal parameters, then, the number of generic parameter may increase
a bit too much, at the cost of readability or at the cost of easy of
use. Using such redundancies sometime, in the opposite, help
readability or is useful when it recall something explicitly, but
sometime, when it is too much, it breaks readability and comes with a
feeling of confusion.

To come back to the first point : one other good reason apart of a
generic package having another generic in its parameters, is when a
generic package B may also be instantiated in a package A, which will
then be use in another package C, which does not have direct access to
the parameters used to instantiate the package (let say it was in a
third package which A deeply rely on one, but not C). Then, one of the
more natural way to access these, if ever needed for other stuff in C,
is the generic package instance B itself.


Randy Brukardt Wrote :

> And changing it surely would be incompatible, at the very
> least with use-visibility

That's an interesting point indeed. I did not though about it at first
sight, because I never Use.



  reply	other threads:[~2009-10-27 22:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26  8:58 Generic package parameters not externally visible : what's the rational ? Hibou57 (Yannick Duchêne)
2009-10-26 11:05 ` Ludovic Brenta
2009-10-26 15:02   ` Robert A Duff
2009-10-27  1:06   ` Hibou57 (Yannick Duchêne)
2009-10-26 14:56 ` Robert A Duff
2009-10-27  3:03   ` Hibou57 (Yannick Duchêne)
2009-10-27 21:08   ` Randy Brukardt
2009-10-27 21:36     ` Jeffrey R. Carter
2009-10-27 22:03       ` Hibou57 (Yannick Duchêne) [this message]
2009-10-27 22:19         ` Jeffrey R. Carter
2009-10-28 19:07         ` Randy Brukardt
2009-10-29 12:18           ` Hibou57 (Yannick Duchêne)
2009-10-29 22:56             ` Randy Brukardt
2009-10-30  0:10               ` Hibou57 (Yannick Duchêne)
2009-10-27 22:04       ` Hibou57 (Yannick Duchêne)
2009-10-27 23:37       ` Robert A Duff
2009-10-27 23:41         ` Jeffrey R. Carter
2009-10-27 23:34     ` Robert A Duff
2009-10-28  2:19       ` Hibou57 (Yannick Duchêne)
2009-10-28 19:12         ` Randy Brukardt
2009-10-29  7:34           ` Stephen Leake
2009-10-29 12:21           ` Hibou57 (Yannick Duchêne)
2009-10-29 13:10             ` AdaMagica
2009-10-29 15:11               ` Georg Bauhaus
2009-10-29 19:28                 ` Jeffrey R. Carter
2009-10-29 20:27                   ` Georg Bauhaus
2009-10-30 10:30               ` Stephen Leake
2009-10-30 17:53             ` Ludovic Brenta
2009-10-31  2:10               ` Hibou57 (Yannick Duchêne)
2009-10-30  5:19           ` Hibou57 (Yannick Duchêne)
2009-10-28  9:09     ` Dmitry A. Kazakov
2009-10-28 19:19       ` Randy Brukardt
2009-10-29  8:36         ` Dmitry A. Kazakov
2009-10-29 23:03           ` Randy Brukardt
2009-10-30  8:51             ` Dmitry A. Kazakov
2009-10-30 10:25           ` Stephen Leake
2009-10-30 19:32             ` Dmitry A. Kazakov
2009-10-31  2:06               ` Hibou57 (Yannick Duchêne)
2009-10-31  9:14                 ` Dmitry A. Kazakov
2009-11-03  8:25                   ` Hibou57 (Yannick Duchêne)
2009-11-03  9:59                     ` Dmitry A. Kazakov
2009-11-05 10:38                       ` Hibou57 (Yannick Duchêne)
2009-11-05 11:00                         ` Dmitry A. Kazakov
2009-11-05 12:16                           ` Hibou57 (Yannick Duchêne)
2009-11-05 14:09                             ` Dmitry A. Kazakov
2009-11-06 12:19                               ` Hibou57 (Yannick Duchêne)
2009-11-06 13:27                                 ` Dmitry A. Kazakov
2009-10-31  2:08               ` Hibou57 (Yannick Duchêne)
2009-10-31 12:44               ` Stephen Leake
2009-11-01 11:37                 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox