qmuntal / stateless

Go library for creating finite state machines
https://wikipedia.org/wiki/Finite-state_machine
BSD 2-Clause "Simplified" License
975 stars 53 forks source link

add args to Transition #27

Open okhowang opened 3 years ago

okhowang commented 3 years ago

related #16

qmuntal commented 3 years ago

Can you specify why you need the arguments in the Transition? They are normally already passed in the function call-backs.

okhowang commented 3 years ago

I want write log once state changed for debugging state machine. And args is the detail info of transition.

qmuntal commented 3 years ago

I'm hesitant to add the Arguments property to Transition. It does make sense but there are already many callbacks whose parameters are a transition and the arguments, so it would be confusing to have the arguments in both place.

Yet your use case is valid, so I will think on a way to cover it. Other proposals are also welcomed.

okhowang commented 2 years ago

@qmuntal is any better way here?

okhowang commented 7 months ago

@qmuntal is any better way here after 2 years?