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

Sverker Eriksson sverker@REDACTED
Tue Sep 13 11:42:19 CEST 2011

Joseph Wayne Norton wrote:
> I'm currently developing a disk based clone of the ets application.   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
It is the intended behavior.
I don't think the documentation is contradicting but it could be much 
more clearer and contain something like:

For tables of the ordered_set type, next/2 will succeed regardless of 
Key1. For other tables Key1 must exist in the table or have existed the 
last time the tables was "unfixed" (see safe_fixtable/2), otherwise 
badarg is thrown.

/Sverker, Erlang/OTP

More information about the erlang-questions mailing list