-
Notifications
You must be signed in to change notification settings - Fork 57
Accommodate Starlark reserved keywords as Protobuf message field names #119
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
Accommodate Starlark reserved keywords as Protobuf message field names #119
Conversation
|
@seena-stripe @dl-stripe Apologies for the direct tag; would one of you be the right person to review this change? Thanks. |
|
@LINKIWI Are these PRs still something you're interested in landing? If so, please rebase them and i'm happy to review. Sorry for the (extreme) delay. |
ee500b3 to
fcb2fe1
Compare
Hi, thanks for the reply. Yes, we've been running these patches in production internally for about a year now, and it would be great if we could get these upstreamed as well. I've rebased #119, #120, and #121. Thanks! |
| "pass": true, | ||
| "return": true, | ||
| // Identifiers reserved for future use | ||
| "as": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, do these work today? Little concerned that this is technically a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a couple of these and it doesn't seem to work today.
message Foo {
...
string import = ...;
}
pb.Foo(import = "a")
message Foo {
...
string as = ...;
}
pb.Foo(as = "a")
For these cases, the evaluation error is: got illegal token, want binary expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
|
@LINKIWI , would you like to add yourself to |
fcb2fe1 to
597dce8
Compare
Sure |
|
@LINKIWI just to dot the or an employer? |
The copyright holder is me. |
The Protobuf language permits identifiers that are reserved in Starlark, like
pass. Consider, for example:There is currently no way to express this in Skycfg, since this is (correctly) flagged as a Starlark syntax error. For example:
Language-specific Protobuf code generation plugins typically work around such collisions by suffixing identifiers with an underscore. This PR proposes using the same convention to enable use of such reserved keywords as attribute names when creating Protobuf messages in Skycfg.
This enables the above example to be expressed as:
Verification
I updated the unit tests.