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-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!postnews.google.com!d70g2000hsc.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: overriding in private part Date: Fri, 3 Oct 2008 08:54:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <45b4a4cc-13f5-4175-9061-9c962e32d762@64g2000hsm.googlegroups.com> <47e26a8d-d104-46c5-b841-667f6e556792@w7g2000hsa.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1223049287 1777 127.0.0.1 (3 Oct 2008 15:54:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 3 Oct 2008 15:54:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d70g2000hsc.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2220 Date: 2008-10-03T08:54:47-07:00 List-Id: On Oct 3, 1:52 am, "Dmitry A. Kazakov" wrote: > > But > > since "overriding" has been added, you should just use it, and it will > > solve the problem. > > Unfortunately it does not. I shouldn't have said "solve". It *partially* solves the problem, in that if the programmers use "overriding" and "not overriding" consistently on everything, it won't let you write a program that has an unexpected result of the sort Maxim ran into. Of course, having the compiler tell you your program is illegal isn't really a full solution when the language should be letting you do what you need to do, but it's a heck of a lot better than accepting your program and doing the wrong thing. > The programmer desired to override P2, and this > is impossible to do, because there is a type in between which effectively > *hides* the operation in all packages, regardless their visibility. > Further, this behavior changes when the offending type is derived in A1 > rather than in A1.A2. In that case A1.A3 would be able to override P2. > > This is obviously broken to me. I think this is a good point, and I'm trying to think of a possible solution. The small stumbling block is that it's possible to declare a private extension in a package Package_1 type T1 is new T with private; and then, in the private part of Package_1: type T1 is new T2 with ... where T2 is a child of T. Clearly, any *new* operations that were declared for T2 but not for T shouldn't be visible, or overridable, by any package that can't see into the private part of Package_1. But that just means that any proposed change would have to be written a bit more carefully; it's not an insurmountable obstacle. Anyway, I'm thinking about how this could be fixed. -- Adam