March 06, 2014 [Issue 12305] New: infer context from "this" of aliased methods | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=12305 Summary: infer context from "this" of aliased methods Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: thecybershadow@gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow@gmail.com> 2014-03-06 16:44:54 EET --- ////// testStruct.d ////// struct A { void fun() { } void caller(T)(T t) { t.callee(); // NG } } struct B { alias callee = A.fun; } void main() { A a; B b; a.caller(b); } ////////////////////////// The above currently does not work. If you replace t.callee() with T.callee(), then it compiles. However, that prohibits generic programming when "callee" is an actual method of "T". Note that this currently works with nested classes: /////// testClass.d ////// class A { void fun() { } class B { alias fun = A.fun; } } void main() { A a = new A; A.B b = a.new B; b.fun(); // OK } ////////////////////////// -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2014 [Issue 12305] infer context from "this" of aliased methods | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | https://d.puremagic.com/issues/show_bug.cgi?id=12305 Vladimir Panteleev <thecybershadow@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> 2014-03-06 17:57:07 EET --- https://github.com/D-Programming-Language/dmd/pull/3361 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation