The New and Improved edoc

Ulf Wiger ulf.wiger@REDACTED
Tue Feb 24 18:22:29 CET 2004


On Tue, 24 Feb 2004 17:42:22 +0100 (MET), Richard Carlsson 
<richardc@REDACTED> wrote:

Since this is going well, I press on with feature requests. (:

I'd like to be able to indicate with some macro that the actual
function implementation be included as documentation. This would
be especially useful when providing an example behaviour callback.
I know I can copy and paste the code wrapped in <pre>...<pre>,
but it would be nice to eliminate that step.

An example -- perhaps not the best way to express it, but I'm on my
way home:

%% @spec handle_leader_call(Msg::term(), From::callerRef(), State::term(),
%%                          E::election()) ->
%%    {reply, Reply, NewState} |
%%    {reply, Reply, Broadcast, NewState} |
%%    {noreply, NewState} |
%%    {stop, Reason, Reply, NewState} |
%%    commonReply()
%%
%% @doc Called by the leader in response to a
%% {@link gen_leader:leader_call/2. leader_call()}.
%% <p>If the return value includes a <code>Broadcast</code> object, it will
%% be sent to all candidates, and they will receive it in the function
%% {@link from_leader/3. from_leader/3}.</p>
%% <p>Example:</p>
%% {@include_code}
handle_leader_call({store,F}, From, Dict, E) ->
     NewDict = F(Dict),
     {reply, ok, {store, F}, NewDict};
handle_leader_call({leader_lookup,F}, From, Dict, E) ->
     Reply = F(Dict),
     {reply, Reply, Dict}.
%% {@end_include_code}
%%@end

/Uffe
-- 
Ulf Wiger, Senior System Architect
EAB/UPD/S

This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the erlang-questions mailing list