-
Notifications
You must be signed in to change notification settings - Fork 488
Adds an ident-<lang>-const command line option for each language. #271
base: master
Are you sure you want to change the base?
Adds an ident-<lang>-const command line option for each language. #271
Conversation
…so, adds support for camel case Djinni members being converted to underCaps. Previously an underscore was not added for each upper case letter.
Automated message from Dropbox CLA bot @fostah, it looks like you've already signed the Dropbox CLA. Thanks! |
A few comments:
|
When you say, "...cases of them being used." Are you referring to within Djinni itself or as part of the examples/test-suite? If you mean the former, Djinni already supports customizing const style, it just didn't expose it through the CLI options. So no further changes were needed. For background on the camel case support: we weren't aware that the Djinni interfaces were only suppose to include under_lower style. We defined all our interfaces with camel case. This worked fine for everything but our C++ and Java constants, where we would SEECONSTANTSNAMEDLIKETHIS. Hence the change to underCaps specifically. I can remove the underCaps change. However, looking at IdentStyle, it would be easy for me to add support for camel case in the Djinni interfaces to the rest of the style options, if you're open to it. camelUnder and camelLower already support it, and the change to underLower and underUpper would be very similar to what I did for underCaps. |
Oh, I didn't realize const style customization was an internal feature you were simply exposing. Makes more sense now, thanks. Which other ident styles were you using in Java and C++? There's definitely an assumption that the names in IDL are under_lower, which you can see in the various ident style definitions, e.g. the fact that underLower() simply returns its input, or that underUpper() splits on underscore. I'm not averse to supporting different styles in the IDL file, but I feel like it should be done in a way which supports all options, not just some of them, which might mean a separate command-line arg to tell Djinni what input form to expect. Are there specific styles in generated code weren't able to support using under_lower in IDL and some combination of Djinni arguments? Or do you just prefer camelCase names in your IDL files? If the latter, do you use them for everything (including class names), or just for "variable" names? |
The choice to use camelCase was a preference and we use it for everything in our Djinni interface files. The only problem that it caused was with underCaps. However, we don't leverage underLower and underUpper. I think supporting all the generated code styles in the Djinni interfaces would be possible, without a separate command-line argument. I would like to, at least, take a crack at it. For this pull request, though, I think it would make sense to revert the camelCase support changes and just focus on exposing the const style customization. They're not related and I don't want the const style change held up while I experiment with the Djinni interface style support. |
I like the idea of splitting this PR, to land the const options, and work on the variable styling separately. If you have an idea of how to support multiple styles cleanly without an argument I'm open to it, though I'm a bit wary of embedding too many assumptions such as the split-on-underscore-else-on-capital in this PR. It think it might be better to be explicit, and support all styles if you're going to support more than one. |
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.
Invoking code review flow now that it's available. Per the prior conversation, I think the next step is is for @fostah to remove the generator changes for input style from this diff, to allow the constant style arguments to be merged independently and leave the broader input style issue to be addressed separately.
Also, adds support for camel case Djinni members being converted to underCaps. Previously an underscore was not added for each upper case letter.