Changes to ref parameters by a tunnel that was a parameter do not live past the tunnel
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
Inky version information:
```
Inky version: 0.8.0
ink version: 0.7.4
inkjs version: 1.6.0
```
I couldn't figure out how to express this coherently, so here's some code to reproduce:
```
~ temp val = 1
~ temp val2 = 5
initial values: {val}, {val2}
-> deref(-> load_1, val, val2) ->
final values: {val}, {val2}
VAR MY_VALUE_1 = 10
=== load_1(ref val, msg) ===
pre set {msg}: {val}
~ val = MY_VALUE_1
post set {msg}: {val}
->->
=== deref(-> func1, ref out, ref out2) ===
~ temp my_value_1 = 2
-> func1(out, "parameter") -> func1(my_value_1, "temp") ->
post-divert parameter: {out}
post-divert temp: {my_value_1}
constant divert:
-> load_1(out2, "constant") ->
->->
```
Output from Inky preview pane:
```
initial values: 1, 5
pre set parameter: 1
post set parameter: 10
pre set temp: 2
post set temp: 10
post-divert parameter: 1
post-divert temp: 2
constant divert:
pre set constant: 5
post set constant: 10
final values: 1, 10
End of story
```
When `load_1` is tunneled using the `func1` name, the changes to the variable do not persist beyond the tunnel (`post-divert parameter: 1`, `post-divert temp: 2`), but when it's tunneled by `load_1`, the changes do persist (`post set constant: 10`, `final values: 1, 10`)
I got similar behavior running the code in Unity.
Because I can see the question arising, I'm trying to do something like this because it seemed like a succinct way to manage groups of variables, though on reflection, I'm not sure my initial design would have scaled, and there's a way of doing this that should avoid this issue, and have better ergonomics. Regardless, there's something weird going on here.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.