18 Aug 17:32
Edoc optional function parameters
From: Matt Williamson <dawsdesign <at> gmail.com>
Subject: Edoc optional function parameters
Newsgroups: gmane.comp.lang.erlang.general
Date: 2008-08-18 15:33:10 GMT
Subject: Edoc optional function parameters
Newsgroups: gmane.comp.lang.erlang.general
Date: 2008-08-18 15:33:10 GMT
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 <at> spec for each one. Here's what I have now:
%%===================================================================
%% API
%%===================================================================
%%-------------------------------------------------------------------
%% <at> spec put(Node, Key, Value) -> Result
%% Result = {ok, inserted, Key} | {error, notinserted}
%% Key = term()
%% Value = term()
%% Node = node()
%% <at> 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}).
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 <at> spec for each one. Here's what I have now:
%%===================================================================
%% API
%%===================================================================
%%-------------------------------------------------------------------
%% <at> spec put(Node, Key, Value) -> Result
%% Result = {ok, inserted, Key} | {error, notinserted}
%% Key = term()
%% Value = term()
%% Node = node()
%% <at> 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}).
<div><div dir="ltr">Hello,<br><br>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 <at> spec for each one. Here's what I have now:<br><br>%%===================================================================<br>%% API<br>%%===================================================================<br>%%-------------------------------------------------------------------<br>
%% <at> spec put(Node, Key, Value) -> Result<br>%% Result = {ok, inserted, Key} | {error, notinserted}<br>%% Key = term()<br>%% Value = term()<br>%% Node = node()<br>%% <at> doc Inserts a Key, Value pair into the server.<br>
%%-------------------------------------------------------------------<br>put(Key, Value) -><br> put(node(), Key, Value).<br><br>put(Node, Key, Value) -><br> gen_server:call({simpledb_svr, Node}, {insert, Key, Value}).<br>
</div></div>
RSS Feed