@property - take it behind the woodshed and shoot it?

mist none at none.none
Thu Jan 24 11:36:08 PST 2013


One thing I am interested to hear from ones who think allowing 
no-parens calls is fine is the following snippet:

http://dpaste.1azy.net/cd2f759e

------------------------------------------------------------
import std.stdio;

alias Delegate1 = int delegate();
alias Delegate2 = Delegate1 delegate();

Delegate2 func()
{
	writeln("Function");
	return (){
		writeln("First delegate");
		return (){
			writeln("Second delegate");
			return 42;
		};
	};
}

int call(alias func)()
{
	return func;
}

void main()
{
	writeln("Case 1");
	func;
	writeln("Case 2");
	func();
	writeln("Case 3");
	func()();
	writeln("Case 4");
	auto tmp = func();
	// tmp; // Error: var has no effect in expression (tmp)
}
------------------------------------------------------------

Upon any design choice questions should asked:
1) How this should behave to be consistent?
2) Should this error be an error?
3) How much special casing are you ready to throw in?

Also I really like an addition with prohibiting to use @property 
functions _with_ parens. Add this to prohibiting no-parens calls 
for normal ones and you will get my ideal solution, strict and 
clear.

And I still don't see why it won't fly. Yes, it will break user 
code. No, this is not an issue. At this point it is clear some 
design mistakes need to be corrected without stockpiling 
workarounds and one of major goals for new release process was to 
allow breaking changes with least possible user inconvenience. If 
it is not the case, then new release process has failed as much 
as @property.


More information about the Digitalmars-d mailing list