"Alexey Verkhovsky" <alex_verk / mail.ru> wrote in message
news:40748346.70007 / mail.ru...
> Resulting code is somewhat more verbose, but comes out rather stable due
> to very clean separation of buttons and logic.

Have you considered generating the state machine code from an explict
description of the machine?

state (:s1) { ... some static conditions when in :s1, entry/exit actions,
etc.for s1 }
state (:s2, s2) { ....}
transition (:s1, :s2, :e1) { ... }

It should be quite possible, particularly since you have full Ruby blocks
alongside.