On Thursday, 31 March 2016 at 13:48:27 UTC, Adam D. Ruppe wrote:
It is trying to look up a name i in global scope, and calling
writeln on it.
This is why the .name syntax exists: so you can bypass local
variables with the same name when trying to access a global.
It would compile if you put
On Thursday, 31 March 2016 at 13:39:25 UTC, ixid wrote:
What is going on with UFCS and foreach?
foreach(i;0..5).writeln;
This is not UFCS; it is calling writeln on module scope. See
http://dlang.org/spec/module.html#module_scope_operators
Your code is semantically identical with
foreach (i
On Thursday, 31 March 2016 at 13:39:25 UTC, ixid wrote:
What is going on with UFCS and foreach?
There's no such thing as UFCS on foreach. UFCS only works on
variables, not a foreach statement.
foreach(i;0..5).writeln;
You can add a line break and optional braces there to see wh
On Thursday, 31 March 2016 at 13:39:25 UTC, ixid wrote:
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
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