Open jiyoontbd opened 4 weeks ago
FSMs are deliberately not exportable because they require implementation details in order to use, specifically the "instance key". If you think of a module like a traditional class, it would be like exposing the internal private implementation details directly to all callers.
In your example, whatever the instance key is for each Send() call would have to be an implementation detail known to all callers, which makes future refactoring and maintenance much more difficult because you will have spread those internal details across modules.
That said, we're leaning towards a "allow anything" approach, so we should probably allow this with a warning.
This is blocked on #1691
I have a project that contains 2 modules:
payments
andticketing
. I'd like to initiate a Payment fromticketing
module by using the fsm declared inpayments
module, but currently I must wrapfsm.Send()
call in a Verb insidepayments
module to be called byticketing
module.current behavior
in payments module, declare the FSM
in ticketing module, try to call the FSM by using something like
fsm.Send(...)
, but realize I cannot export the FSMwrite an FTL verb in payments that wraps
fsm.Send(...)
In ticketing module, import the ftl verb from above and call it
expected behavior
Once
fsm
is created in a module, I'd like to be able to reference it from any module so I can send events directly viafsm.Send(..)