ifandelse / machina.js

js ex machina - finite state machines in JavaScript
http://machina-js.org/
Other
1.93k stars 147 forks source link

Question about Fsm definition in source code #90

Closed igncp closed 9 years ago

igncp commented 9 years ago

Hi,

When looking into the Fsm definition, there is some code repetition in some methods (e.g. handle, transition, etc.). Maybe it would be nice to change the definition of some methods so it is more clear and expressive their common relation. I added a gist to show what I mean (all tests passing):

https://gist.github.com/igncp/071632ed5d6fa4d7f8d0

Maybe I am missing some drawbacks of the change. What do you think about this change in terms of architectural improvement or deterioration?

ifandelse commented 9 years ago

Hi @igncp, I apologize for the delay in replying. I'll check out the gist and post back here once I've had a moment to review and try it out, thanks!

ifandelse commented 9 years ago

@igncp I don't have any problem with this change - I think it cleans up quite a bit of the repetition I have in the current version. You up for opening a PR containing this update?