foreach UFCS
ixid via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 31 06:52:45 PDT 2016
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 an `int i;` at the top of your
> module... try it!
Thanks, that makes sense! I had forgotten the global dot syntax.
That seems like a somewhat sketchy syntax given how little one
would use it, wouldn't something like:
writeln(i).global;
be much clearer for globals?
More information about the Digitalmars-d-learn
mailing list