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

Enable variable modifications to layer changes on the same variable #681

Merged

Conversation

douglasjacobsen
Copy link
Collaborator

This merge allows modifiers that modify the same variable to layer their changes onto the modified variable.

Previously, only the last modifier to modify a variable would have it's modification stick.

This commit allows modifiers that modify the same variable to layer
their changes onto the modified variable.

Previously, only the last modifier to modify a variable would have it's
modification stick.
@douglasjacobsen douglasjacobsen added bug Something isn't working enhancement New feature or request labels Oct 3, 2024
Copy link
Collaborator

@linsword13 linsword13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do you think it'd be good to add a test for it?

@douglasjacobsen
Copy link
Collaborator Author

I added a test, and updated existing modifiers to include the space separator as part of their variable modifications (given I removed the auto-injected space)

@linsword13
Copy link
Collaborator

I added a test, and updated existing modifiers to include the space separator as part of their variable modifications (given I removed the auto-injected space)

Do you feel having the separator auto-injected would be less error-prone than relying on modifier author to remember adding the space?

Perhaps a more general approach is to have the directive to accept a template_func ((prev_value, new_mod) => new_value)? (More just for a discussion, no need to add to the current PR though.)

@douglasjacobsen
Copy link
Collaborator Author

Yes, I actually have an internal task tracking this which I think is a high priority.

Injecting a space manually is definitely a hack for the time being, and we should have a nicer interface for this.

@linsword13 linsword13 merged commit 67233a1 into GoogleCloudPlatform:develop Oct 4, 2024
12 checks passed
@douglasjacobsen douglasjacobsen deleted the layered-variable-mods branch October 4, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants