[erlang-bugs] Bug in gb_trees ? Integer key not found.

Robert Virding <>
Wed May 11 03:42:46 CEST 2011


Wouldn't the easiest and cleanest solution to this problem be just add gb_trees:from_list? I have no idea why there isn't one.

I don't know if orddict could be an opaque type as the point of it is that the representation is defined to be an ordered list.

Robert

----- "Anthony Ramine" <> wrote:

> Le 10 mai 2011 à 00:30, Kostis Sagonas a écrit :
> 
> > Anthony Ramine wrote:
> >> Le 9 mai 2011 à 23:56, Kostis Sagonas a écrit :
> >>> <aside>
> >>> Note that the two calls might have different semantics actually:
> >>> 
> >>>  1> orddict:from_list([{2,a},{1,b},{2,a},{3,c}]).
> >>>  [{1,b},{2,a},{3,c}]
> >>>  2> lists:sort([{2,a},{1,b},{2,a},{3,c}]).
> >>>  [{1,b},{2,a},{2,a},{3,c}]
> >>> </aside>
> >>> 
> >>> Is this call to lists:sort/1 correct/intentional?  Only the
> original developer can answer such questions, if he happens to still
> recall whether this was done just to save a millisecond or for some
> other reason...  God only knows how many possible subtle bugs may be
> hidden in such (or similar) code.
> >> lists:ukeysort/2 removes duplicates.
> > 
> > Right, I know. So does lists:usort/1.
> > 
> > And your point is what exactly?
> > 
> > Kostis
> 
> Sounds like I forgot to type the most important part of the mail.
> Shouldn't this sort of nasty trick where the rationale tend to be
> undocumented and forgotten really fast be avoided in the crucial parts
> of OTP?
> 
> --
> Anthony Ramine
> Dev:Extend
> http://dev-extend.eu
> 
> 
> 
> 
> _______________________________________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-bugs


More information about the erlang-bugs mailing list