Adam Beneschan <adam@[EMAIL PROTECTED]
> 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
im****t it into a different scope with the _same_ name, and Ada's
renaming declaration is too powerful for that job.
- Bob


|