alias this and shadowing

2017-06-15 Thread Jonathan Shamir via Digitalmars-d
I think the following example is legitimate code that should work: struct S1 { void foo() { writeln("S1.foo()"); } void foo(ulong x) { writefln("S1.foo(%d)", x); } } struct S2 { S1 s; alias s this; void foo(string str) { writeln("S2.foo(%s)",

Re: alias this and shadowing

2017-06-15 Thread Adam D. Ruppe via Digitalmars-d
On Thursday, 15 June 2017 at 15:01:27 UTC, Jonathan Shamir wrote: To quote Andrei, if it looks like it should work, it should. (Also something about turtles). Hmm, interestingly, even if you explicitly merge the overloads with `alias foo s.foo;` (which is required btw, see: http://dlang.org/