Erlang standard library quirks

Matthias Lang matthias@REDACTED
Mon Jan 30 11:05:34 CET 2006

James Hague writes:

 > What standard library quirks bug you?

Two that spring to mind:

  - 'string' and 'list' use conflicting argument order conventions.

    In the string module, all functions which operate on a string
    take the string as the _first_ argument.

    In the list module, the list is _last_ more often than not.

    Example: string:chr versus lists:member

    Not much which can be done about this, I think we're stuck with it.

  - The general vagueness about the speed/size properties of dict, 
    sets, gb_trees and other data structures. gb_trees (1), which
    is one of the 'less vague' ones says

      Behaviour is logaritmic [sic] (as it should be).

    An alternative which is almost as terse, but more informative:

      Insertion, deletion and lookup are O(log N), amortised.

    dict is worse, with just a snooty

       The representation of a dictionary is not defined.

    it may as well say "don't you worry about that". Turns out
    it's a hash (2).


(1): The original (?) paper about gb_trees is pleasantly lucid, a
     pleasure to read:

(2): Read the source, or

More information about the erlang-questions mailing list