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,2bf2853c7c95c600 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Dispatching operations References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Date: Wed, 09 Nov 2005 22:28:43 GMT NNTP-Posting-Host: 67.3.228.237 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1131575323 67.3.228.237 (Wed, 09 Nov 2005 14:28:43 PST) NNTP-Posting-Date: Wed, 09 Nov 2005 14:28:43 PST Xref: g2news1.google.com comp.lang.ada:6334 Date: 2005-11-09T22:28:43+00:00 List-Id: Maciej Sobczak wrote: > The question remains, though: how can I get compile error when calling > private P2.Op_B? > If it's not possible, what's the point in making it private? P2.Op_B is a public operation, inherited as part of the type extension. The Op_B in the private part is an overriding of the inherited operation. Thus, the client has visible an operation named Op_B with a parameter named Arg. Where the private part of the package is visible, the same operation has a parameter named Param. The reason it's in the private part in this example is to show that an overriding can be private, but the client still calls the overriding by calling the inherited operation. It also shows that an overriding can change parameter names. Normally one would put such an overriding in the private part to allow the client to continue to rely on the same parameter names and defaults as the rest of the type hierarchy, while allowing the package implementation to use names or defaults that are more appropriate to the implementation. > When I make this operation (P2.Op_B) public, the it hides the one > inherited from P1.T1 and it is no longer possible to call P2.Op_B(Arg => > X), because the named association of parameter is wrong. This means that > by "promoting" something from private to public (!) in the given package > I can break the existing client of that package. > This is a strange concept to me. Why? If you change the visible part of the package spec, the clients should expect to have to change, too. That's why the compiler will force recompilation of the clients. -- Jeff Carter "To Err is human, to really screw up, you need C++!" St�phane Richard 63