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

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Mon Jan 28 17:59:19 PST 2013


On Tuesday, 29 January 2013 at 00:56:41 UTC, Chad Joan wrote:
> snip
>
> 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;
>
> snip

I have been following the properties discussion a bit and lack
the experience to really comment on much. However, looking at
your posting I couldn't help but ask one question.

You state that not allowing at statement like:

2.bar = 3;

is a 'limitation'. Was 'limitation' really the word you were
looking for?
I find such code rather baffling. Perhaps it has valuable uses
somewhere, which is why I am asking.

It sort of reminds me of Python where you can do something like:

' '.join( list_of_strings )

which is very cute and all, but the following, rather mundane
function call would do a better job of conveying to the reader
what is going on, using the same number of keystrokes:

join( list_of_strings, ' ')

Craig


More information about the Digitalmars-d mailing list