On Thursday, 23 October 2014 at 18:43:54 UTC, tcak wrote:
Then I change the "Test.setIt" method as follows:

                import std.stdio;
                s = cast( typeof( s ) )sock;


Error on "s = cast..." line:
cannot cast module socket of type void to shared(Socket)

Apparently std.stdio defines an alias `sock` to some module. When
you import std.stdio, its `sock` takes precedence over the
parameter `sock`.

I don't know if symbols from local imports should override
parameters just like that. There may be some room for improvement
here.

In the meantime, you can make the import static/renamed/selective:

static import std.stdio; /* must write `std.stdio.foo` */
import io = std.stdio; /* must write `io.foo` */
import std.stdio: foo; /* only foo is imported */

Reply via email to