Skip to content

Commit

Permalink
add WIP section for local var scoping mechanics
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Jul 18, 2020
1 parent ba81898 commit 015de30
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions 029-across-step/proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,39 @@ Note: this is the first time a step *modifier* has had additional sibling
fields. In the event of a field conflict, the `do:` step may be utilized as a
work-around.

### Var scoping

The inner step will be run with a local var scope that inherits from the outer
scope and is initialized with the across step's var values. It follows that the
vars in the local scope are not accessible outside of the `across` step.

Example:

```yaml
plan:
- get_var: foo
trigger: true
- run: print
type: debug
params: {value: ((.:foo))}
- across:
- var: foo
values: [one, two]
do:
- run: print
type: debug
params: {value: ((.:foo))}
- run: print
type: debug
params: {value: ((.:foo))}
```

Assuming the `get_var` step produces a value of `zero`, this build plan should
output `zero`, `one`, `two`, `zero`.

TODO: should shadowing vars (as in the above example) be a validation error? or
maybe a runtime warning? (or allowed?)


## Open Questions

Expand Down

0 comments on commit 015de30

Please sign in to comment.