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

deadalnix deadalnix at gmail.com
Thu Jan 24 21:03:56 PST 2013


On Friday, 25 January 2013 at 01:38:01 UTC, kenji hara wrote:
> 2013/1/25 kenji hara <k.hara.pg at gmail.com>
>>
>>
>> I have thought an additional idea.
>> If we really want a feature to disable optional parentheses 
>> for normal
>> functions, we can add @function attribute to the language spec.
>>
>> int foo();
>> @property int bar();
>> @function int baz();  // new!
>>
>> int x1 = foo();  // ok
>> int x2 = foo;  // optional parentheses, allowed
>> int y1 = bar();  // disallowed, calling int is meaningless
>> int y2 = bar;  // ok
>> int z1 = baz();  // ok
>> int z2 = baz;  // *disallowed* by @function attribute
>>
>
> I think calling a function which does not annotated with 
> @attribute without
> parenthesis is legal, Even if a function has some side-effects 
> and a name
> looks like verb. Because native English grammar does not require
> parentheses.
>
> He runs().  // normal function call
> He runs.    // optional parentheses
>
> Kenji Hara

English grammar don't have any functional style enable. It is not 
possible to return runs itself.


More information about the Digitalmars-d mailing list