digitalmars.D - opDispatch with template parameter and property syntax doesn't work
- Jacob Carlborg (14/14) Jan 12 2010 The following doesn't work, is it a known issue or should I report it.
- Eldar Insafutdinov (2/20) Jan 12 2010 If you watched the presentation by Anders Hejlsberg which was posted her...
- Steven Schveighoffer (8/22) Jan 12 2010 I would expect that in the future you must annotate your opDispatch with...
The following doesn't work, is it a known issue or should I report it.
class C
{
void opDispatch (string str, T) (T t) {}
}
class D
{
void opDispatch (string str) (int t) {}
}
C c = new C;
c.foo = 3; // doesn't work
c.foo(3); // works
D d = new D;
d.foo = 3; // works
Jan 12 2010
Jacob Carlborg Wrote:
The following doesn't work, is it a known issue or should I report it.
class C
{
void opDispatch (string str, T) (T t) {}
}
class D
{
void opDispatch (string str) (int t) {}
}
C c = new C;
c.foo = 3; // doesn't work
c.foo(3); // works
D d = new D;
d.foo = 3; // works
If you watched the presentation by Anders Hejlsberg which was posted here
recently, they have different methods to implement for methods and property
look up for their dynamic type system. I would not want to have them mixed.
Maybe something like opProperty?
Jan 12 2010
On Tue, 12 Jan 2010 14:04:44 -0500, Jacob Carlborg <doob me.com> wrote:
The following doesn't work, is it a known issue or should I report it.
class C
{
void opDispatch (string str, T) (T t) {}
}
class D
{
void opDispatch (string str) (int t) {}
}
C c = new C;
c.foo = 3; // doesn't work
c.foo(3); // works
D d = new D;
d.foo = 3; // works
I would expect that in the future you must annotate your opDispatch with
property to get the correct behavior.
If at that point, C's opDispatch doesn't work like a property, I would
report a bug. The property behavior is very much in flux right now. But
I wouldn't expect IFTI to work on a property syntax like that unless the
function is actually labeled with property.
-Steve
Jan 12 2010









Eldar Insafutdinov <e.insafutdinov gmail.com> 