Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Child Packa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 5643 of 5800
Post > Topic >>

Re: Child Package Operator Visibility

by Robert A Duff <bobduff@[EMAIL PROTECTED] > Apr 13, 2008 at 04:16 PM

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
 




 7 Posts in Topic:
Child Package Operator Visibility
"pakman" <pa  2008-04-05 10:03:27 
Re: Child Package Operator Visibility
"(see below)" &  2008-04-05 15:19:17 
Re: Child Package Operator Visibility
Adam Beneschan <adam@[  2008-04-07 08:03:44 
Re: Child Package Operator Visibility
"(see below)" &  2008-04-07 18:30:40 
Re: Child Package Operator Visibility
Robert A Duff <bobduff  2008-04-13 16:16:34 
Re: Child Package Operator Visibility
Jean-Pierre Rosen <ros  2008-04-14 09:42:21 
Re: Child Package Operator Visibility
Anh Vo <anhvofrcaus@[E  2008-04-07 08:25:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:34:15 CDT 2008.