[erlang-questions] Edoc optional function parameters

Matt Williamson <>
Mon Aug 18 17:33:10 CEST 2008


Hello,

In the docs for gen_server, there for example is call/2,3, two signatures
for the same base function. How do I use edoc to do something similar?
Basically I want one argument to be optional without writing a @spec for
each one. Here's what I have now:

%%===================================================================
%% API
%%===================================================================
%%-------------------------------------------------------------------
%% @spec put(Node, Key, Value) -> Result
%%     Result = {ok, inserted, Key} | {error, notinserted}
%%     Key = term()
%%     Value = term()
%%     Node = node()
%% @doc Inserts a Key, Value pair into the server.
%%-------------------------------------------------------------------
put(Key, Value) ->
    put(node(), Key, Value).

put(Node, Key, Value) ->
    gen_server:call({simpledb_svr, Node}, {insert, Key, Value}).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080818/fd9d84aa/attachment.html>


More information about the erlang-questions mailing list