comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Instantiating private types with discriminants?
Date: 11 May 2006 11:59:37 -0400
Date: 2006-05-11T11:59:37-04:00	[thread overview]
Message-ID: <wccody4lfh2.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 13byov3p0dqhk.yglz3nh5rpb8$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

>...Both
> overloading and overriding are forms of polymorphism, so yes, in that sense
> it is similar. The difference becomes obvious if you have moved
> declarations of Type_A and Type_B into separate packages.

Right.  I suggest that "rick H" should rewrite his examples in the more
usual way -- one tagged type per package, and make them library
packages.

Then you can have a procedure that does dispatching calls to that
abstract subprogram, without having any visibility on the packages where
Type_A and Type_B are declared.

The abstract procedure is a place-holder -- the compiler needs to know
the parameter types and so forth.

> >         Iterator := Iterator.all.Next;
> 
> You don't need "all" here:
> 
>    Iterator := Iterator.Next;
> 
> Ada's pointers are transparent to record member/discriminant and array
> element (indexing) access.

Syntactically transparent, but not semantically.  If the ".all" syntax
weren't so darn ugly, I would recommend always using an explicit
dereference.  I believe there's an option in GNAT (a Restriction
pragma?) that allows you to force yourself to always say ".all",
which might not be a bad idea.

- Bob



  reply	other threads:[~2006-05-11 15:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 13:17 Instantiating private types with discriminants? rick H
2006-05-09 13:45 ` Georg Bauhaus
2006-05-09 14:06   ` rick H
2006-05-09 13:56 ` Ludovic Brenta
2006-05-09 14:24   ` rick H
2006-05-09 19:48     ` Ludovic Brenta
2006-05-09 14:05 ` Dmitry A. Kazakov
2006-05-09 14:48 ` rick H
2006-05-09 15:20   ` Jerry Petrey
2006-05-09 15:42     ` rick H
2006-05-09 15:53   ` Avoiding use Ada.Tags (was Re: Instantiating private types with discriminants?) Alex R. Mosteo
2006-05-09 16:01   ` Instantiating private types with discriminants? Dmitry A. Kazakov
2006-05-10  7:42     ` rick H
2006-05-10  9:09       ` Ludovic Brenta
2006-05-10 11:49         ` Georg Bauhaus
2006-05-10 13:44         ` rick H
2006-05-10 14:21           ` Ludovic Brenta
2006-05-10 15:10             ` rick H
2006-05-10 15:45               ` Ludovic Brenta
2006-05-10 14:41           ` Dmitry A. Kazakov
2006-05-10 15:34             ` rick H
2006-05-10 19:01               ` Georg Bauhaus
2006-05-10 19:05                 ` Ludovic Brenta
2006-05-10 21:52                   ` Rick H
2006-05-11  1:17                     ` Jeffrey R. Carter
2006-05-11  7:44                     ` Dmitry A. Kazakov
2006-05-11  8:27                       ` rick H
2006-05-11 10:28                         ` Dmitry A. Kazakov
2006-05-11 15:59                           ` Robert A Duff [this message]
2006-05-12  7:37                             ` Dmitry A. Kazakov
2006-05-12  9:24                               ` Georg Bauhaus
2006-05-12 12:40                                 ` Dmitry A. Kazakov
2006-05-12 18:25                                   ` Randy Brukardt
2006-05-09 19:57   ` "Use" and "=" for Tags (was: Re: Instantiating private types with discriminants?) Jeffrey R. Carter
replies disabled

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