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

Move GeneratorContext into a standalone class #6618

Merged
merged 5 commits into from
Feb 17, 2022
Merged

Conversation

steven-johnson
Copy link
Contributor

@steven-johnson steven-johnson commented Feb 16, 2022

This is some under-the-hood work to make experiments in implementing Generate in Python a bit more tractable. Currently, GeneratorContext is a base class for Generator, but can't really be used in standalone form (e.g. it's not copyable). For various reasons, this makes the Python code a lot more unpleasant to deal with, so this PR now moves the equivalent of a GeneratorContext inside Generator -- dispensing with the inheritance -- and makes GeneratorComplex much simpler for Python to deal with.

The change should be 100% to downstream code , EXCEPT for code that uses GeneratorStubs -- the first argument to the stub must now be context() rather than this. AFAIK literally no one outside Google has ever used these, so I'd rather just make the small breaking change here and fix the affected areas. EDIT: I added an overload to allow existing code to work as-is.

Drive-by change of moving the ValueTracker into Generator.cpp.

@steven-johnson steven-johnson added the release_notes For changes that may warrant a note in README for official releases. label Feb 16, 2022
@steven-johnson steven-johnson merged commit 7373eb9 into master Feb 17, 2022
@steven-johnson steven-johnson deleted the srj/gencon branch February 17, 2022 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_notes For changes that may warrant a note in README for official releases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants