Property discussion wrap-up

TommiT tommitissari at hotmail.com
Wed Jan 30 08:39:54 PST 2013


On Sunday, 27 January 2013 at 18:12:48 UTC, Artur Skawina wrote:
> struct Plain
> {
>     int a;
> }
> 
> struct Tricky
> {
>     int a;
>     Plain opCall() { return Plain.init }
> }
> 
> void func(int) { }
> 
> // What happens?
> Tricky t;
> t.a.func();

I suppose func is called with Tricky.a, because t is a variable 
not a function.

But, by the way, what are the exact rules of this thing we call 
"optional parentheses"? Perhaps this:

"Empty parentheses may be omitted when calling functions with a 
user-defined name."

That leaves operators, delegates, function pointers, and function 
objects outside of that rule, because they aren't functions with 
a name. But, parens could be omitted with functions whose all 
arguments have default values.


More information about the Digitalmars-d mailing list