-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Provide more user-friendly generator APIs #7326
Comments
It is probably worth adding some new functions (e.g. we already agreed on |
If we're changing a bunch of other things in the API then I think we should provide (and document) non-underscored names—but there's no reason to cause churn: the existing underscored names can be kept indefinitely as aliases/wrappers. |
Rachel & I discussed further and still think it's not worth the additional overhead and churn of adding aliases:
|
We had someone running into issues with |
The most recent request for this comes from a user who wants to add Python imports. We also do this in (generator as AnyDuringMigration).definitions_['import_math'] = 'import math'; (If you are working around this issue in your own code use |
Check for duplicates
Problem
There are a bunch of methods and properties within the generator code that:
The following things are protected but used by generators:
The
provideFunction_
method (which is only supposed to be used for developer-defined functions) is public, but has a sad underscore in the name :/Request
Provide an API that matches what external developers are actually trying to do.
I think it should look something like:
Alternatives considered
Make the protected methods public so they're actually usable. But stick with the less-than-ideal API.
Additional context
Related to #6008 (should possibly supercede it)
The text was updated successfully, but these errors were encountered: