Assigning to non-ref foreach loop variable

Carl Sturtivant sturtivant at gmail.com
Fri Jun 28 14:19:30 PDT 2013


This is deprecated according to dmd 64-bit linux, but no error 
message for Mac or Windows, and exhibits different runtime 
behavior on Windows to those other platforms, as I found out from 
my students using it in a current CS2 class.

Is there some reason why assigning to a non-ref foreach variable 
is permitted at all? Naively, it's a value from the loop's range, 
but not a variable, and so the compiler could treat it as such 
and forbid assignment.


More information about the Digitalmars-d mailing list