From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Child Package Operator Visibility
Date: Sun, 13 Apr 2008 16:16:34 -0400
Date: 2008-04-13T16:16:34-04:00 [thread overview]
Message-ID: <wcciqyl4ijh.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 6b08d1d0-1896-4951-8528-e11bef196dd7@1g2000prf.googlegroups.com
Adam Beneschan <adam@irvine.com> 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
next prev parent reply other threads:[~2008-04-13 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-05 14:03 Child Package Operator Visibility pakman
2008-04-05 14:19 ` (see below)
2008-04-07 15:03 ` Adam Beneschan
2008-04-07 15:25 ` Anh Vo
2008-04-07 17:30 ` (see below)
2008-04-13 20:16 ` Robert A Duff [this message]
2008-04-14 7:42 ` Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox