[erlang-questions] towards a unified dict api

Richard Carlsson carlsson.richard@REDACTED
Fri Dec 30 11:26:45 CET 2011


On 2011-12-30 01:25, Steve Davis wrote:
> On Dec 29, 11:35 am, Richard Carlsson<carlsson.rich...@REDACTED>
> wrote:
>> ...but you shouldn't have to know anything about the implementation.
 >
 > Once, I would have strongly agreed with you. Now, I am not so sure
 > that this tenet is true for many cases. Specifically what guides this
 > change of heart for me is the painful progress in RPC/CORBA/JRMI
 > abstractions over the years. I suspect that it also applies to data/
 > state sources.
 >
 > My 2c.
 > /s

And I basically agree, which is why I'm not aiming for an object 
oriented approach. But I think that letting the dict module have an 
ordered version, just like ets tables, is a good idea. You still get to 
choose between O(n) time for an unordered table and O(log n) time for an 
ordered table when you initialize the dict, and from a usability 
perspective it means that for most cases where you want a functional 
dictionary data type, the dict module is all you need to know.

I couldn't get a good unified dict API until I decided to remove the 
gb_trees module from the equation by making it accessible via dict 
instead, because its current API is too different from the existing 
dict/orddict API and the name clashes got too difficult to resolve. I 
could of course also invent a new name for gb_trees, but that seems 
unnecessary.

    /Richard



More information about the erlang-questions mailing list