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

           Summary: Associative arrays have wrong opIndex signatures
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: and...@metalanguage.com


void main()
{
    int[string] x;
    char[] y;
    if (y in x){}
    int z = x[y];
}

The last two lines do not compile. However it makes of course sense to look up
for a char[] or const(char)[] in a hash keyed by immutable(char)[]. Only the
operator that inserts stuff into the hash should force the type
immutable(char)[].

Bottom line: if the type of the key is K, any type K1 that allows comparison
for equality and less-than with K should be accepted for lookup.


-- 

Reply via email to