-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Labels
Description
Breakout from #18 to better discuss and judge interest.
Often it is useful to have two states that are very similar, with a few different expressions. Since Continue and state transitions are disallowed due to possible infinite loop issues, a way of reducing development time and redundant SLOC would be to allow a state to import another state which would be evaluated as a setup time macro.
E.g:
Start
\<some expressions\>
$$IMPORT ToImportState
\<some expressions\>
ToImportState
\<some expressions\>
^\S -> Start
Questions:
- is there interest in this feature?
- is there interest in a separate import feature that does not allow the imported statements to initiate a state transition?
- What might the syntax look like? Currently the $$IMPORT is a placeholder.
Potential issues:
- Cyclical dependencies. This would be solved by not importing anything which has already been imported into a state. Another option would be only to allow immediate imports.
- Debug output statements would become slightly more complex. A current suggestion is to provide a back trace like:
line: 10.102.50where line 50 is the error, but was imported by line 102, which was in turn imported from line 10, which is your current state. - This would likely add complexity to the visual debugger HTML-Based Visual Debugger #48 .
- Unless using only immediate imports as a simple copy-paste macro, or forgoing a reasonable debug output, this feature would add a decent amount of complexity to multiple parts of the code.
Personally, when I was writing/editing/maintaining templates this feature probably would have saved me a few hours a month in development time. Which is to say it would have been nice but clearly wasn't a deal-breaker.