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

Gunilla Arendt <>
Mon Mar 12 09:39:06 CET 2007


Yes, it should be handle_cast/2. Thanks for pointing it out,
I'll fix it in R11B-4.

Thanks,
Gunilla, Erlang/OTP team

Bob Ippolito wrote:
> 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