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

Wyatt wyatt.epp at gmail.com
Tue Jan 29 10:06:23 PST 2013


On Tuesday, 29 January 2013 at 00:56:41 UTC, Chad Joan wrote:
> Would everyone be able to agree to only use @property functions 
> as properties?  This would still allow omittable parens as a 
> way to make call-chaining and ufcs nicer.
>
I've been thinking and, while it may just be a side effect of my 
code style or my own inexperience, I honestly can't think of a 
situation where I'd want I'd want to use a non- at property function 
as an lvalue as described here.

> The limitation this imposes is that
>   void foo(int a) {...}
>   void bar(int a, int b) {...}
> cannot be called in this way:
>   foo = 2;
>   2.bar = 3;
>
> As a consequence, everyone's favorite
>   writeln = "lolwut";
> does not compile.
>
Do people really do this with any degree of frequency?  None of 
the examples I've seen read well to me, and readability of code 
is an important consideration when we need to represent semantic 
meaning with syntactic saccharides.


More information about the Digitalmars-d mailing list