foreach UFCS

ixid via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 31 06:39:25 PDT 2016


What is going on with UFCS and foreach?

foreach(i;0..5).writeln;

This prints five line breaks.

foreach(i;0..5).i.writeln;

This will not compile.

foreach(i;0..5).writeln(i);

This writes out 1 to 4 on separate lines. Is this supposed to 
work? I thought a.b would be rewritten to b(a) with UFCS but 
writeln(foreach(i;0..5)) is nonsensical and does not compile and 
should be the same as foreach(i;0..5).writeln;


More information about the Digitalmars-d-learn mailing list