Summary: Associative arrays have wrong opIndex signatures
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

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

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