associative arrays: to sort or not to sort?

BCS none at anon.com
Wed Jul 21 19:58:20 PDT 2010


Hello Mario,

> But then, JSON has a jew more unspecified gaps like "whitespace can be
> inserted between any pair of tokens".
> 

That can be dealt with by just being consistent.

> Shall we rely on the fact that the implementation currently does not
> insert whitespace between tokens?

On the output side, why not? The unit test is for this implementation after 
all.


> And you have to provide opCmp in order to put your own keys into an
> associative array, so why don't you get them out in order?

That's because AA's use closed hashing with tree used to deal with col3sions.

> 
> However, let's get things done: can the attached unittest be an
> acceptatble replacement for the broken one of std.json?
> 

Move line 35 and 38 up one place each and you can drop the check for permutations.

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list