[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #10 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-07-11 08:27:55 PDT --- Fixed in 2.054 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 --- Comment #3 from Steven Schveighoffer schvei...@yahoo.com 2011-05-24 14:44:26 PDT --- I think the better solution is to change it to const(char)[]. This better reflects that the data may be changing between iterations. If you are not storing the strings from this, then it is extremely wasteful to allocate a new memory block for each iteration. You can always idup or dup if you want to. Note, I think the documentation needs to specifically state it reuses the buffer, so you should .dup or .idup if you wish to keep the data beyond the loop iteration. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 --- Comment #5 from Steven Schveighoffer schvei...@yahoo.com 2011-05-24 15:28:28 PDT --- I completely misunderstood the problem here, I thought the string was being directly returned in the opApply delegate, not a Key object. Yes, I agree, the string should be idup'd. Doing anything differently would require a redesign (which I think actually is in order, to allocate that much data to do a simple loop is incredibly wasteful), but since nobody is owning this, your solution is as good as we can get for now. Sorry for the noise. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 --- Comment #6 from Andrej Mitrovic andrej.mitrov...@gmail.com 2011-05-24 16:53:41 PDT --- Yeah from a quick glance at the registry module it does seem a little fishy overall. __gshared variables, ASCII-only WinAPI calls (what if the registry key is in UTF, if that's possible?), casts to strings.. maybe this module needs to be refactored. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 --- Comment #8 from Steven Schveighoffer schvei...@yahoo.com 2011-05-24 17:08:24 PDT --- I think this was a D1 module casted to D2 to get it to compile :) Probably would be better served reimplemented, but obviously someone would have to spend some quality time doing that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5059] String assignment in foreach loop breaks immutability
http://d.puremagic.com/issues/show_bug.cgi?id=5059 Jesse Phillips jesse.k.phillip...@gmail.com changed: What|Removed |Added CC||jesse.k.phillip...@gmail.co ||m --- Comment #1 from Jesse Phillips jesse.k.phillip...@gmail.com 2011-04-28 10:13:09 PDT --- This is a bug in KeySequence's opApply. The function is reusing a char[] for every iteration, it then casts this to a string, but ends up being modified for each call to Reg_EnumKeyName_. https://github.com/D-Programming-Language/phobos/blob/master/std/windows/registry.d#L1870 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---