[Issue 8363] Empty array literal does not implicitly convert to associative array
https://issues.dlang.org/show_bug.cgi?id=8363 Oliver Rümpeleinchanged: What|Removed |Added Status|NEW |RESOLVED CC||ol...@fg4f.de Resolution|--- |WONTFIX --- Comment #6 from Oliver Rümpelein --- Starting with 2.071, you can use "aa.clear()" to achieve the desired behaviour. If you are still in the need for the proposed syntax, please reopen this issue or write a DIP (as this would modify the behaviour of the language). --
[Issue 8363] Empty array literal does not implicitly convert to associative array
http://d.puremagic.com/issues/show_bug.cgi?id=8363 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||yebbl...@gmail.com Summary|Provide an intutive way to |Empty array literal does |clear all entries in|not implicitly convert to |Associative Array |associative array --- Comment #3 from yebblies yebbl...@gmail.com 2012-07-10 01:54:12 EST --- (In reply to comment #0) aa = []; // clear all array entries This should probably work. At this point only this works. I think this is not very intuitive. int[string] aa; int[string] empty; aa[foo] = 1; aa = empty; try aa = null; But be careful, don't forget AAs are reference types. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8363] Empty array literal does not implicitly convert to associative array
http://d.puremagic.com/issues/show_bug.cgi?id=8363 Jonathan M Davis jmdavisp...@gmx.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #4 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-09 10:45:46 PDT --- aa.clear() should work. I believe that that's the same as setting it to null. It doesn't actually remove anything from the AA. It just makes that reference null. If you want to actually remove all of the elements from the AA, you currently have to iterate over them and call remove on each one. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8363] Empty array literal does not implicitly convert to associative array
http://d.puremagic.com/issues/show_bug.cgi?id=8363 --- Comment #5 from Jonathan M Davis jmdavisp...@gmx.com 2012-07-09 11:02:47 PDT --- However, with clear being renamed to destroy for 2.060 (with clear scheduled for deprecation), I don't see any problem with adding a clear function to AAs which actually clears the AA (that's probably what most everyone using clear on AAs wanted anyway). Presumably, that could be done as part of the AA implementation redesign that's currently being worked on. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---