March 23, 2005 Mixin name collisions that shouldn't be | ||||
---|---|---|---|---|
| ||||
Try this. import std.stdio; class A { template _B() { int C() { return 10; } int opCall() { return 15; } } mixin _B b; template _T() { int C() { return 20; } int opCall() { return 25; } } mixin _T t; } void main() { A a=new A; writefln(a.b.C()); writefln(a.t.C()); // doesn't like these writefln(a.b()); writefln(a.t()); } For some reason, accessing a.b.C() and a.t.C() is just fine, but it doesn't like having those multiple opCalls, even though I'm fully qualifying their names. |
April 20, 2005 Re: Mixin name collisions that shouldn't be | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jarrett Billingsley schrieb am Wed, 23 Mar 2005 17:02:22 -0500: > Try this. > > import std.stdio; > > class A > { > template _B() > { > int C() > { > return 10; > } > > int opCall() > { > return 15; > } > } > > mixin _B b; > > template _T() > { > int C() > { > return 20; > } > > int opCall() > { > return 25; > } > } > > mixin _T t; > } > > void main() > { > A a=new A; > writefln(a.b.C()); > writefln(a.t.C()); > > // doesn't like these > writefln(a.b()); > writefln(a.t()); > } > > For some reason, accessing a.b.C() and a.t.C() is just fine, but it doesn't like having those multiple opCalls, even though I'm fully qualifying their names. Added to DStress as http://dstress.kuehne.cn/run/mixin_12.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCZrQ63w+/yD4P9tIRAkAvAJ0ey2nXJqIc5Km2FYEHJOUOtEwMQgCfSkT8 nYU7VnU3ZNBcISBQiMa2iN4= =MWEq -----END PGP SIGNATURE----- |
Copyright © 1999-2021 by the D Language Foundation