UFCS syntax I never saw before.

Rubn where at is.this
Mon May 21 11:49:49 UTC 2018


On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote:
> After all this time I saw this:
>
> writeln = iota = 5;
>
> what??
>
> I never saw that before!
>
> This is interesting, there is something useful that i can do 
> with this kind of call?

I probably wouldn't use that. That wasn't what it was intended 
for and it's not really UFCS. It's was meant for properties that 
are defined as functions.

struct SomeStruct
{
     void foo(int);
}

SomeStruct s;
s.foo = 10;

It's kind of horrible syntax for what it is doing, where it isn't 
obvious what is happening. Writeln and iota aren't setting 
anything, they are just function calls that happen to be able to 
take one parameter.


More information about the Digitalmars-d-learn mailing list