Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous EditLabel constructor in Msg type in Machine.elm #110

Open
Necried opened this issue Aug 3, 2021 · 0 comments
Open

Ambiguous EditLabel constructor in Msg type in Machine.elm #110

Necried opened this issue Aug 3, 2021 · 0 comments

Comments

@Necried
Copy link
Collaborator

Necried commented Aug 3, 2021

In the current codebase we have EditLabel StateID String, which suggests that the Machine type provides an interface for entering an edit state when a StateID is selected. However, the way its used in Building.elm disobeys this assumption, as the ID can be both a StateID and TransitionID:

finsm/src/Building.elm

Lines 347 to 360 in 398f02c

EditLabel _ lbl ->
let
newState =
case model.machineState of
EditingStateLabel st _ ->
EditingStateLabel st lbl
EditingTransitionLabel tr _ ->
EditingTransitionLabel tr lbl
_ ->
model.machineState
in
( ( { model | machineState = newState }, pModel, sModel ), False, Cmd.none )

In fact, it just ignores the ID and instead checks the state of the machine. In npda-v3, I refactored this into EditStateLabel and EditTransitionLabel, which then has a one-to-one relationship to EditingStateLabel and EditingTransitionLabel respectively.

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

No branches or pull requests

1 participant