stateless icon indicating copy to clipboard operation
stateless copied to clipboard

Use generics for State and Trigger

Open soypat opened this issue 2 years ago • 4 comments

Go 1.18 official release brings Generics to the table!

soypat avatar Mar 18 '22 11:03 soypat

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!

qmuntal avatar Mar 18 '22 11:03 qmuntal

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?

soypat avatar May 18 '22 01:05 soypat

@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.

husam-e avatar Feb 21 '24 02:02 husam-e