From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,dad94612ff745427 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Instantiating private types with discriminants? Date: 11 May 2006 11:59:37 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1147252198.138173.203910@j73g2000cwa.googlegroups.com> <44623869$0$4504$9b4e6d93@newsread2.arcor-online.net> <87d5elk8e9.fsf@ludovic-brenta.org> <13byov3p0dqhk.yglz3nh5rpb8$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1147363177 9485 192.74.137.71 (11 May 2006 15:59:37 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 11 May 2006 15:59:37 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news2.google.com comp.lang.ada:4199 Date: 2006-05-11T11:59:37-04:00 List-Id: "Dmitry A. Kazakov" 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