Workaround for DIP 1005
Dominikus Dittes Scherkl via Digitalmars-d
digitalmars-d at puremagic.com
Fri Feb 3 06:43:01 PST 2017
DIP 1005 provides new syntax to make it possible to avoid global
imports.
Till now global imports are necessary if a function uses types
declared in some imported module within it's declaration or
definition (otherwise a local import will do).
But this can already be worked around with some nice trick:
import someModule.SomeType;
SomeType fun()
{
...
}
can be replaced by:
fun.ST fun()
{
import someModule.SomeType;
alias ST = SomeType;
...
}
The same strategy works with types used in parameters or
constraints, of course.
Any thoughts?
More information about the Digitalmars-d
mailing list