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

Compute arguments iterator immediately, instead of on first use #11

Closed
BenWoodworth opened this issue Nov 11, 2023 · 0 comments
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@BenWoodworth
Copy link
Owner

BenWoodworth commented Nov 11, 2023

Currently in v0.1, a parameter's arguments wait to be computed until it's first used. Especially in the case of the lazy parameter {...}, unused parameters won't have their arguments calculated, saving on unnecessary computation.

However, this blocks a few desired features:

1. Avoiding re-calculation of independent parameter

See #3. Having a gap between a parameter's declaration and when its arguments are calculated means dependence between parameters can't be tracked, making it impossible to add an optimization for re-using an arguments iterable. Immediately calculating the arguments would enable this optimization

2. Parameters that are only used after the iteration completes

See #10. There is reason to calculate arguments even if the parameter isn't used by the time the iteration completes. So if arguments are going to be calculated anyway, then that might as well happen right away as that's most intuitive. That would break the current behavior, but if we need the argument, the options are break the current behavior and compute them at a different time, or keep the current behavior and slip the computation in at the end. Which... would be both unintuitive and needlessly complicated with no real benefit.

3. Iterating arguments upon declaration

See #12.

@BenWoodworth BenWoodworth added the enhancement New feature or request label Nov 11, 2023
@BenWoodworth BenWoodworth self-assigned this Nov 11, 2023
@BenWoodworth BenWoodworth added this to the 0.2 milestone Nov 11, 2023
BenWoodworth added a commit that referenced this issue Nov 16, 2023
This will make it possible to avoid re-calculating independent parameters, enable captured parameters be used only after an iteration completes, and iterate arguments closer to their declaration. See issue #11 for context.

The code was minimally modified to change the behavior, and tests were changed to account for arguments iteration in declaration order instead of usage order (since that's now the order arguments are calculated and depend on each other).
BenWoodworth added a commit that referenced this issue Nov 20, 2023
This will make it possible to avoid re-calculating independent parameters, enable captured parameters be used only after an iteration completes, and iterate arguments closer to their declaration. See issue #11 for context.

The code was minimally modified to change the behavior, and tests were changed to account for arguments iteration in declaration order instead of usage order (since that's now the order arguments are calculated and depend on each other).
BenWoodworth added a commit that referenced this issue Nov 20, 2023
This will make it possible to avoid re-calculating independent parameters, enable captured parameters be used only after an iteration completes, and iterate arguments closer to their declaration. See issue #11 for context.

The code was minimally modified to change the behavior, and tests were changed to account for arguments iteration in declaration order instead of usage order (since that's now the order arguments are calculated and depend on each other).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant