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,f37364fd74b84042 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Child Package Operator Visibility Date: Sun, 13 Apr 2008 16:16:34 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <6b08d1d0-1896-4951-8528-e11bef196dd7@1g2000prf.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1208117794 11273 192.74.137.71 (13 Apr 2008 20:16:34 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 13 Apr 2008 20:16:34 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:2A8T+sMB7VpRZi+mpOACbnv+qVA= Xref: g2news1.google.com comp.lang.ada:20918 Date: 2008-04-13T16:16:34-04:00 List-Id: Adam Beneschan writes: > In fact, this sort of thing is an idiom I used to use a lot, before > Ada 95 gave us "use type". Me, too. >...I would declare a package with the types I > wanted to declare, and then define a nested package Operators which > redefined all the operator symbols on those types using renaming, so > that another package could say "use Pkg.Operators" without having to > "use Pkg" which would make too much visible. Nobody would type: function "+" (X, Y: T) return T renames Pkg."+"; function "-" (X, Y: T) return T renames Pkg."-"; ... Instead, you type: function "+" (X, Y: T) return T renames Pkg."+"; Cut&paste, to get: function "+" (X, Y: T) return T renames Pkg."+"; function "+" (X, Y: T) return T renames Pkg."+"; ... Then fix it up: function "+" (X, Y: T) return T renames Pkg."+"; function "-" (X, Y: T) return T renames Pkg."+"; ... Oops. Now you've got a nasty bug, which is hard to see. ;-) The problem is that you don't want to "rename" anything -- you want to import it into a different scope with the _same_ name, and Ada's renaming declaration is too powerful for that job. - Bob