On 04/02/2017 3:43 AM, Dominikus Dittes Scherkl wrote:
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?

Needless syntax sugar:

struct Foo { int x; }

Foo func() {
        return Foo(9);  
}

typeof(func()) func2() {
        return func();  
}

void main() {
        assert(func2.x == 9);   
}

Reply via email to