The use of "type" as a field name seems suspect to me in a test thrift file for the reason you described.
This is similar to the use of "what" that was in some example thrift files exception structures before we added what() to the C++ library, breaking those examples. Fortunately one can rename the field if using BinaryProtocol because it only cares about field ordinals, not names, and remain backwards compatible. Perhaps we need to update the list of reserved keywords and enforce them? Another possibility is to change the code generator to generate a field in a structure that has a different name like "__type", however would the definition of "getType()" then fail in your language? By the way, what is your target language? You didn't specify. - Jim -----Original Message----- From: Allen George [mailto:[email protected]] Sent: Thursday, November 03, 2016 10:00 PM To: [email protected] Subject: What's the right approach to dealing with reserved words in thrift structs? The struct "Bonk" (in ThriftTest.thrift) uses a reserved keyword "type" in my target language. What's the right approach do dealing with reserved keywords during code generation? Obviously I'd prefer that "type" wasn't used at all, but...should I turn it into another name? Should I simply fail instead? Thanks, Allen Terminal Musings: http://www.allengeorge.com/ Raft in Java: https://github.com/allengeorge/libraft/ Twitter: https://twitter.com/allenageorge/ --------------------------------------------------------------------------------------- PRIVACY STATEMENT: This message is a PRIVATE communication. This message and all attachments are a private communication sent by SimpliVity and are considered to be confidential or protected by privilege. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the information contained in or attached to this message is strictly prohibited. Please notify the sender of the delivery error by replying to this message, and then delete it from your system. ---------------------------------------------------------------------------------------
