[erlang-questions] ets:next/2 behavior - set vs. ordered_set

Jachym Holecek freza@REDACTED
Mon Sep 12 23:17:40 CEST 2011


# Joseph Wayne Norton 2011-09-12:
> I'm currently developing a disk based clone of the ets application.

Interesting, I was considering doing something like that for an upcoming
project -- are you planning to make the result open source by any chance?

;-)

> During testing with QuickCheck and Proper, I stumbled upon a difference between
> set and ordered_set for the real ets:next/2 operation.
> 
> The last command exits with badarg rather than '$end_of_table' as I would expect.
> 
> Can someone comment on this behavior?  Is this a bug?  Is this a documentation bug?

FWIW I've always read this:

    next(Tab, Key1) -> Key2 | '$end_of_table'

        Returns the next key Key2, following the key Key1 in the table Tab.

as "behaviour is undefined if Key1 isn't a key in Tab". That ordered_set
tables support even non-key items has been mentioned on the mailing list
in passing some while ago, I've found it very surprising...

BR,
	-- Jachym



More information about the erlang-questions mailing list