[erlang-questions] Erlang 3000?

damien morton dmorton@REDACTED
Sat Nov 15 19:54:19 CET 2008


I don't suppose there's and Erlang 3000 project in the works?

The Python people set out to create Python 3000, throwing backwards
compatibility out the window in favour of fixing language and library
design errors.

I mentioned earlier the variety of ways that the Erlang libraries
signal returning a value or not. Some examples:

proplists:get_value(Key, List) -> undefined | Value

dict:find(Key, Dict) -> {ok, Value} | error

gb_tree:lookup(Key, Tree) -> {value, Val} | none

dets:lookup(Name, Key) -> [Object] | {error, Reason}

ets:lookup(Tab, Key) -> [Object]

All these operations on standard ADTs are roughly equivalent, and yet
they have different or conflicting naming conventions, different
return value protocols, and different orderings of their arguments.

While ets:lookup and dets:lookup return a tuple, one of whose members
is the key, gb_tree:lookup return the value of a {key,value} pair.

gb_tree:lookup, dict:find and proplists:get_value all perform the same
operation, and though the return value protocol is different in each
case, at least the arguments are the same.

The key asset for any well designed language or library is
learnability, which comes from regularity, i.e. having learned
something in one situation, one can apply that knowledge to similar
situation with a high probability of success.

Erlang already does a lot of things differently from other languages,
but when every single library module does things differently from the
others, well, that's a lot of heterogeneity for a novice to deal with.

I wasted an hour so so tonight trying to figure out a problem that
stemmed from proplists having a different argument ordering to ets - I
just instinctively assumed they had the same argument ordering, and
why shouldn't I?



More information about the erlang-questions mailing list