On Wed, Jan 9, 2013 at 12:52 PM, Era Scarecrow <rtcv...@yahoo.com> wrote:
>> That's weird. Why does that work? Directly pasting the mixin content in >> main() does not compile, right? > > I can only assume if it does work, that the mixin template has it's own > scope that enables the overloading. If you can't do it with one, you > shouldn't be allowed to do it with the other. That must be it. mixin can have names (mixin TemplateName AliasName;) which the functions as a disambiguator. I don't have access to a D compiler right now. Does this work?: void main() { { void test(ref int x) { x = test(); } int test() { return 1; } } int x; test(x); assert(x == 1); } > Overloading within nested functions is likely a rare use case. I hit it while trying to change a module from struct+methods to purely functions everywhere, to see if there were any efficiency difference.