thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4496) Dealing with language keywords in Thrift (e.g. service method names)
Date Wed, 27 Jun 2018 20:38:00 GMT


ASF GitHub Bot commented on THRIFT-4496:

Jens-G edited a comment on issue #1567: THRIFT-4496: python specific list of keywords for
python generator
   At least in theory it seems simple. In practice it may require some more work (but only
   1. Get rid of that global thing or reduce it down to the absolute minimun. Place a big
comment on to and below that anybody who is ever going to add a keywored to that list without
a really good reason will be punished (methaporically speaking, of course).
   2. Create a mechanism flexible enough to suit the needs of all code generators that deals
with language-specific Keywords.
   3. Every morning repeat the mantra "**The issue is the code generation, not the IDL. It's
the generator, not the parser.**"
   IDL  ==>  Model / AST  ==>  Generated Code
   not         not               ... but ^ here
   here        here               is the issue!

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Dealing with language keywords in Thrift (e.g. service method names)
> --------------------------------------------------------------------
>                 Key: THRIFT-4496
>                 URL:
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (General)
>            Reporter: Vera Filippova
>            Priority: Minor
> Apache Thrift compiler doesn't allow to use keywords in any of supported languages as
field names. However, there are other compilers, like Scrooge, which do allow using some keywords
as field identifiers, which leads to incompatibility.
> Assume we had a service with 'delete' method, with Java code generated by Scrooge. Now
we'd like to generate Python code with Apache Thrift, but encounter an error because of the
'delete' keyword.
> I understand that using only Apache Thrift compiler, a user will never encounter this
problem, but I think enabling keywords by request seems feasible.
> h1. Proposal
> It's possible to tweak keywords on code generation stage, e.g. use 'delete_' as a name
of a generated function instead of 'delete', then use the original method name for a protocol
message: writeMethodBegin('delete').
> This feature could be enabled with an additional flag, e.g. --screen-keywords.
> I have a draft for python generator here []
> The questions are, is this functionality welcome? If yes, would it require to have it
supported for all languages?

This message was sent by Atlassian JIRA

View raw message