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,e19a809544945098 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!w4g2000prd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: worrying behaviour Date: Fri, 2 May 2008 11:31:31 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: 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 1209753091 6294 127.0.0.1 (2 May 2008 18:31:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 2 May 2008 18:31:31 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w4g2000prd.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:21176 Date: 2008-05-02T11:31:31-07:00 List-Id: On May 2, 10:41 am, echancr...@gmail.com wrote: > Thanks Adam for your comprehensive answer. > I know there is no error here, I just thought that if you explicitly > bother to provide a renaming operator declaration it would be > reasonable for the compiler to expect an explicit definition for it... Not at all; I think it's quite common to rename implicitly declared operators. > Of course declaring the type private would highlight the problem > but ... are you really sure that in the real world those mistakes are > not made? (would be pretty hard to detect and would probably only be > revealed on boundary cases) They may well be made. But a compiler can't reasonably catch all mistakes. > After all what is the point of renaming an operator and not provide an > actual body for it but the default one? To be able to use the operator without having to USE the package. USE TYPE makes this less necessary, but there's a lot of legacy code out there written before Ada 95. Also, there may be reasons why USE TYPE is undesirable in particular situations, but I'm not sure what they are... perhaps others could elaborate if there are. Actually, now that I think of it, your question doesn't make that much sense. Other than the reason I've alluded to (i.e. making an operator visible), I don't see any point to renaming an operator that *does* have an actual body for it---I don't see why the explicitness or implicitness of the operator's definition makes any difference. (There are cases where you need a rename to avoid an ambiguity, but in those cases you wouldn't be renaming an operator to the same operator string, so I'm assuming that case isn't relevant to this discussion.) -- Adam