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

deadalnix deadalnix at gmail.com
Thu Jan 24 21:12:19 PST 2013


On Friday, 25 January 2013 at 01:28:05 UTC, kenji hara wrote:
> 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
>
> How about?
>

@function seems like an extra complication. Ambiguity between 
setter and getter for @properties when UFCS come into play are 
not solved. Functional style is impaired as you can't pass 
regular function around, just @function . You'll still find trap 
in generic code around the behavior of regular functions.


More information about the Digitalmars-d mailing list