opPropDispatch

Adam D. Ruppe destructionator at gmail.com
Sun Apr 22 16:01:48 PDT 2012


On Sunday, 22 April 2012 at 22:36:12 UTC, Jonathan M Davis wrote:
> Eventually -property will be the normal behavior.

Note that -property adds zero value, much like the current
implementation of @property, which fails to disambiguate
cases:

==
import std.stdio;

alias void delegate() callable;

class Test {
	@property callable a() { return { writeln("hello"); }; }
}

void main() {
	auto t = new Test();
	t.a(); // does NOT say hello
         t.a()(); // this does
}
==

I thought this case was the WHOLE POINT of adding
@property, and it is still wrong.

Note that this should work just fine without the
pointless baggage that is -property, since the
@property gives the necessary info to disambiguate
it. But, apparently, the compiler ignores it all,
with or without the switch.


More information about the Digitalmars-d-learn mailing list