www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8473] New: Guaranteed relative key-values with byKey and byValue

http://d.puremagic.com/issues/show_bug.cgi?id=8473

           Summary: Guaranteed relative key-values with byKey and byValue
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



This is a spinoff of Issue 5466

There is a common need to have a (lazy) range of keys and their corresponding
values of an associative array. Sometimes iterating them in parallel with a
foreach is not enough, and performing a lookup for each key generated by byKeys
is not efficient.

So I suggest to state in the D docs that if the associative array is not
modified in the iteration, its byKey and byValue yield corresponding key-values
(this is currently true, but not guaranteed to be true in all D
implementations). 

This means that this will always be true in all future D implementations:

zip(aa.byKey, aa.byValue) === aa.byPair

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2012