boost-ext / sml

C++14 State Machine library
https://boost-ext.github.io/sml
Boost Software License 1.0
1.14k stars 177 forks source link

Question about states and data #566

Open kielby opened 1 year ago

kielby commented 1 year ago

Is the statement on the tutorial pageoutdated?

SML states cannot have data as data is injected directly into guards/actions instead.

On the examples page in the data section it shows otherwise right? Or is the statement above regarding something else? https://boost-ext.github.io/sml/examples.html#data

MatthiasKleesSchulz commented 1 year ago

Nope, the tutorial is not outdated. It is true, the STATE itself cannot have data. The example shows how u can store data in the STATEMACHINE. An other solution is to work with dependencies.

martinerk0 commented 1 year ago

@MatthiasKleesSchulz Can I ask what's the difference between "states cannot have data" and "Another solution is to work with dependencies"?