Uniform Function Call Syntax(UFCS) and @property
Jonathan M Davis
jmdavisProg at gmx.com
Thu Mar 3 08:33:13 PST 2011
On Thursday 03 March 2011 01:52:09 kenji hara wrote:
> The two semantics have no relation with each other.
>
> My idea is that we allow 'this' keyword as the first parameter of free
> function: ----
> T t;
>
> void method(T)(ref T this){...}
> --> t.method();
> void method(T, A...)(ref T this, A args){...}
> --> t.method(arg1, arg2);
>
> @property bool empty(T)(ref T this){...}
> --> if (t.empty){...}
> @property void empty(T)(ref T this, bool f){...}
> --> t.empty = true;
> ----
>
> Do you think?
Why use this like that? UFCS is supposed to work with any function just like
using the member function call syntax works with arrays and any function -
otherwise it's not universal. And I would expect @property to work without
"this". The functions you list should work just fine with arrays without the use
of the keyword "this" and without the first parameter being a ref. The same
should be true for UFCS if it's ever implemented.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list