private alias for module
Myron Alexander
someone at somewhere.com
Mon Aug 13 16:11:00 PDT 2007
Hello.
I would like to declare an alias private to the module. As of D1.020,
this is not the case and the specification seems to agree with the
implementation.
By private alias, I mean (eg):
> ----- somemodule ----
> module somemodule;
> import std.string.toString;
> private alias std.string.toString str;
> ... code that uses str ...
>
> --- main ----
> import somemodule;
> void main () {
> str (50); // should fail
> }
Is there a way to do this?
At the moment, I understand my only options as:
1. Selective import with function rename
2. Create another module for the alias and import into "somemodule"
Problem with option 1 is that I then have to declare each function I
use. Problem with option 2 is that I have an additional file.
If this is by design, then what is the reasoning behind forbidding
private aliases?
Thanks ahead,
Myron Alexander.
More information about the Digitalmars-d-learn
mailing list