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

Subplanner support #22

Merged
merged 14 commits into from
Jun 27, 2021
Merged

Subplanner support #22

merged 14 commits into from
Jun 27, 2021

Conversation

Arachnid
Copy link
Contributor

This PR adds support for 'subplanners' - nested executions of weiroll that share their state arrays but have distinct command lists.

Example usage:

const planner = new Planner();

const subplanner = new Planner();
const sum = subplanner.add(Math.add(1, 2));

planner.addSubplan(SubcommandContract.execute(subplanner, subplanner.state));
planner.add(Events.logUint(sum));

const { commands, state} = planner.plan();

Return values from one subplan can be used in the parent scope, and even in other subplans. The planner constructs command lists for subplanners and inserts them into the state.

@Arachnid Arachnid requested a review from decanus June 20, 2021 23:15
@github-actions
Copy link

size-limit report 📦

Path Size
dist/weiroll.js.cjs.production.min.js 31.03 KB (-6.1% 🔽)
dist/weiroll.js.esm.js 29.17 KB (-6.4% 🔽)

@Arachnid Arachnid merged commit 1ed2bd2 into main Jun 27, 2021
@Arachnid Arachnid deleted the subplanners branch June 27, 2021 07:48
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.

3 participants