Connect input / output ports of components via getters, instead of overwriting object references #329
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We ran into the issue that using sub xircuits only really worked when the parameters passed to them were literals. If the output of another component was passed, the value would end up being
None
because theInArg
object is overwritten with theOutArg
object of its input, thereby producing stale references within the component.By overwriting the getter of the
InArg
to simply produce the value of theOutArg
we don't run into this particular problem anymore.In principle I'd prefer if we had a more explicit
InArg.connect(OutArg)
kind of thing instead of usingsetattr
in the generated code, but that requires a change in the base components definition, and that in turn requires users to update files manually. And I'd prefer not to do that for a change that is targeted for a patch release.Pull Request Type
Type of Change
Tests
1. Manual Test
Tested on?