Use generics for State and Trigger
soypat opened this issue · 4 comments
Go 1.18 official release brings Generics to the table!
I've been playing with type parameters since the beginning, but I'm still not sure if they are a good addition to this library.
Anyway, you can try them by pointing to typeparams branch and check the diffs at #35.
If you do so, please report back with your experience!
I ended up coding a state machine implementation from scratch with a generic input argument. See https://github.com/soypat/go-maquina.
Wondering if maybe there's room for a related projects section in the readme to point users to this smaller state machine implementation?
@qmuntal adding generic support would be quite valuable. Are you still open to contributing this to the lib? I'm exploring options for statechart libraries and type safety for states and triggers would be a meaningful benefit.
I am proposing an updated version in #35 (comment)