Skip to content

Conversation

walkie
Copy link
Contributor

@walkie walkie commented Sep 3, 2021

This significantly refactors the generation of the state context initialization code in the Rust backend, making state contexts work correctly and consistently for all ways of entering a state (initial state, transitions, and change-states).

Previously, state contexts were only initialized correctly for transitions, which led to limitations in initial states described in #22 and in change-states, described in #27. Both of these issues are fixed.

For initial states, only state variables and exit parameters are allowed (i.e. not state parameters or enter parameters). It could be possible to also allow either state parameters or enter parameters by passing these in to the state machine constructor. However, it's not clear which of these should take precedence. Also, these features are usually only accessible in Frame, so it would be inconsistent to allow access to them from Rust for initial states. Thus, it seems like a reasonable limitation that these features are not available for initial states.

For change-states, enter and exit parameters are not allowed since these events are not triggered by a change-state.

This PR needs approval from @frame-lang since the PR includes a minor change to the parser to enable parsing state parameters on change-states.

Fixes #22
Fixes #27

@walkie walkie requested a review from frame-lang September 3, 2021 19:10
@walkie
Copy link
Contributor Author

walkie commented Sep 3, 2021

Whoops, forgot to commit my final changes. 😳

The PR should be updated now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust backend: implementation of change-state is incomplete Rust backend: initial state contexts are not initialized properly
2 participants