UFCS syntax I never saw before.

aliak something at something.com
Thu May 24 22:05:38 UTC 2018


On Tuesday, 22 May 2018 at 14:33:20 UTC, Jonathan M Davis wrote:
> A free function with a single argument works just fine as a 
> setter property. e.g. you could do something like
>
> void env(Tuple!(string, string)[] str)
> {
>     // set environment variables
> }
>
> env = [tuple("foo", "bar")];
>
> is perfectly legal. I question that there are many cases where 
> such a function would be considered good design, but basically 
> any case where it would make sense to have a function act like 
> a global variable is currently allowed but would be disallowed 
> if you couldn't have a setter property with only one argument.
>
> - Jonathan M Davis

That can be attributed with @property if the developer intends 
for it to be used in that way, else should be illegal.




More information about the Digitalmars-d-learn mailing list