[erlang-questions] OTP Design Principles doc bug (Gen Server Behaviour: 2.5)

Bob Ippolito bob@REDACTED
Mon Mar 12 00:36:38 CET 2007


I'm pretty sure there is a documentation error in the example code here:
http://erlang.org/doc/doc-5.5.3/doc/design_principles/gen_server.html#2.5

When the request is received, the gen_server calls
handle_cast(Request, State) which is expected to return a tuple
{noreply, State1}. State1 is a new value for the state of the
gen_server.

handle_call({free, Ch}, Chs) ->
    Chs2 = free(Ch, Chs),
    {noreply, Chs2}.

I would expect this example to be:

handle_cast({free, Ch}, Chs) ->
    Chs2 = free(Ch, Chs),
    {noreply, Chs2}.

-bob



More information about the erlang-questions mailing list