[erlang-questions] [erlang-bugs] Very minor documentation bug in proplists module

Richard Carlsson <>
Wed Sep 24 11:33:09 CEST 2008


Bengt Kleberg wrote:
> The proplists module is (IMHO) somewhat byzantine and I did not
> understand that lookup/2 is the main primitive.

Oh, it's not all that bad (now that I look at it again), but it
could do with a lot more examples. In particular, it's not obvious
what all the expansion/substitution stuff is good for. But it is;
here is some example code from the hipe module (simplified a bit):

----
expand_options(Opts) ->
  proplists:normalize(Opts, [{negations, opt_negations()},
                             {aliases, opt_aliases()},
                             {expand, opt_basic_expansions()},
                             {expand, opt_expansions()}]).

opt_negations() ->
  [{no_binary_opt, binary_opt},
   {no_bitlevel_binaries, bitlevel_binaries},
   {no_debug, debug},
   ...
   {no_use_indexing, use_indexing}].

opt_aliases() ->
  [{'O0', o0},
   {'O1', o1},
   {'O2', o2},
   {'O3', o3}].

opt_basic_expansions() ->
  [{pp_all, [pp_beam, pp_icode, pp_rtl, pp_native]}].

opt_expansions() ->
  [{o1, o1_opts()},
   {o2, o2_opts()},
   {o3, o3_opts()},
   {x87, [x87, inline_fp]}].
----

  /Richard




More information about the erlang-questions mailing list