Do we want functions to act as properties, or merely omit parens for ufcs/chaining?

Sönke Ludwig sludwig at outerproduct.org
Tue Jan 29 02:34:34 PST 2013


Am 29.01.2013 05:16, schrieb sclytrack:
> On Tuesday, 29 January 2013 at 01:09:17 UTC, F i L wrote:
>> why in the hell would you want:
>>
>>     writeln = "lolwut";
>>
>> to compile in the first place?
> 
> If you disallow this. You will have to invent something else than opDispatch.
> Something that serves them both. opPropMethodDispatch maybe.


template opDispatch(string name)
{
	static if( isAProperty!name ){
		@property int opDispatch() { return 0; }
	} else {
		void opDispatch() {}
	}
}

or similar should work.


More information about the Digitalmars-d mailing list