[erlang-bugs] Minor typos in FSM example

Brian Candler B.Candler@REDACTED
Mon Aug 18 13:43:31 CEST 2008


I think there are a couple of typos in the FSM example at
http://www.erlang.org/doc/design_principles/fsm.html#ex

(1) Spurious semicolon at the end of the case statement in locked/2, which
prevents it compiling

(2) Timeout value disagrees with that given in the text (30 seconds)

--- code_lock.erl.orig  2008-08-18 12:34:51.000000000 +0100
+++ code_lock.erl.new   2008-08-18 12:34:40.000000000 +0100
@@ -18,11 +18,11 @@
     case [Digit|SoFar] of
         Code ->
             do_unlock(),
-            {next_state, open, {[], Code}, 3000};
+            {next_state, open, {[], Code}, 30000};
         Incomplete when length(Incomplete)<length(Code) ->
             {next_state, locked, {Incomplete, Code}};
         _Wrong ->
-            {next_state, locked, {[], Code}};
+            {next_state, locked, {[], Code}}
     end.

 open(timeout, State) ->

After this, and after adding do_lock and do_unlock functions, it compiled
and ran fine.

Regards,

Brian.



More information about the erlang-bugs mailing list