associative arrays

Manfred Nowak svv1999 at hotmail.com
Sat Jan 7 21:03:45 PST 2012


Jonathan M Davis wrote:

> So, as far as I can tell, the current situation is more efficient

There are some more arguments:

1) Different threads might want to `remove' the same key from the AA. I 
don't see a reason why only the first served thread should complete the 
operation without an error.

2) Because there is only one operation for insertion of a key into an 
AA, only one operation should be used for removing that key.

Note: This argument vanishes if insertions are divided in 
  a:declaration of a key as valid in that AA,
  b:first assignment to the value of a key,
  c:reassignment to the value of a key

3) Reverse operations should not implement more functionality than the 
reversed operation. Because `remove' is the reverse operation for 
inserting a key and that operation does not cause any error, neither 
should errors be given from `remove'.

Note: Reassigning to the value of a key might very well treated as an 
error.

-manfred


More information about the Digitalmars-d-learn mailing list