[Issue 12305] New: infer context from "this" of aliased methods
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 6 06:44:56 PST 2014
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 at puremagic.com
ReportedBy: thecybershadow at gmail.com
--- Comment #0 from Vladimir Panteleev <thecybershadow at 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: -------
More information about the Digitalmars-d-bugs
mailing list