-
Notifications
You must be signed in to change notification settings - Fork 421
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
Naming convention for names containing acronyms in standard modules #20240
Comments
Thanks for opening this, David! FWIW, this question drives me bonkers (in that I don't feel like there's a good answer). My understanding (based on what others tell me) is that Python preserves capitalizations of acronyms but that Microsoft does not (?). I'd also be curious what the Julia/Swift/Rust positions on this question would be. David, in your example, it's not obvious what would cause us to use
If we didn't preserve capitalization earlier in the identifier, I'd be open to granting exceptions for capitalizations at the end of identifiers personally. It's inconsistent, but with good reason (there's no ambiguity as to where the acronym stops). |
One piece of guidance we might potentially agree upon easily is that if acronyms can be replaced with a short-ish word, the word may be preferable. For example, I think we recently replaced |
In the example that I took from #17936 (comment) DOM stands for Document Object Model so I'd expect it to be all capitalized if written by itself. |
I just ran into an interesting case to me, which was imagining an argument named |
That's an interesting case, Brad. But would "our style guide states that all names use camelCase or PascalCase" be enough to recognize that it should be a capital I, since "localeld" doesn't obviously look like a single word? |
To me, there are two issues here. The first is whether it's unfortunate that 'ID' would be written 'Id' which is also a word and short. The second is the potential confusion about I vs. i (though, as the GitHub formatting points out, with a serif font, that's less of an issue). The first part still stands, though. |
I think I'm a little confused. Isn't "id" here an abbreviation for "identifier"/"identity"/etc., not an acronym? Are you worried it will be confused with "id" from psychoanalysis? Or something else I'm not thinking of? |
I believe the dyno team picked blahAst for the compiler data structures that refer to Abstract Syntax Trees. We don't necessarily have to be consistent across the compiler written in C++ and our libraries, but we should at least be aware. @mppf , @dlongnecke-cray, or @arezaii do you have any input? |
Dyno has
I prefer routines to be consistent camel case. I can usually map back mentally to the acronym from the routine name or a formal type if need be. But personally I tend to stumble over |
Yes, for the most part we are using (or trying to use) a style like |
This was discussed at a module 2.0 re-review meeting yesterday. The team that discussed it voted between three main options (we also briefly discussed some other options like capitalizing short acronyms):
There was nearly even support for options 2 and 3. The people who supported option 3 said they were willing to accept option 2 so that is our choice. Michael is updating StandardModuleStyle.rst to include this choice. |
I don't object with the decision here per se, but just as a point of order, my understanding is that when we break into these subteams, that subteam doesn't have the power to make the final decision on the topic in isolation (since it's impossible for someone interested in multiple topics to attend them if they're occurring simultaneously), but instead owns the task of trying to create a consensus and then reflecting that choice back to the full group for objections or insights that they may have missed. Tagging @lydia-duncan as I think this is how she's explained the intended format in the past as well. |
I'd also be curious for a readback on whether any discussion occurred around the comment I posted to chat once I knew I'd be missing the discussion: "I thought someone asserted lately that Python didn't do it that way, which made me wonder whether we were aligning with the wrong approach, and/or which other languages are using this approach." Specifically, are we diverging from Python, and if so, if a Python user complains to us about the choice, do we have an explanation for why we diverged, and is there a precedent to point to to assure them that we're not going off into the wild on our own? |
The subteam does have the obligation to give those that weren't present a last chance to object. However, if we're finding that too many of the topics are not getting resolved because we could not get all interested parties in the room, then perhaps we should move back to full group discussions. |
I think Python's approach is to make acronyms all uppercase for class names and all lowercase otherwise. This stack overflow post has the following example: >>> import ipaddress # IP is lowercase because this is a module
>>> ipaddress.IPv4Address # IP is uppercase because this is a class
<class 'ipaddress.IPv4Address'>
>>> ipaddress.ip_network # IP is lowercase because this is a function
<function ip_network at 0x0242C468>
>>> We don't plan to follow python in this because it doesn't work well when using |
Option 2 from #20240 (comment) was the choice after notifying the whole team and giving time for any additional comments. |
For posterity: In a discussion about
And then a related follow-up question was: If we did permit one of these exceptions, are we requiring that the exception be applied? (e.g., if we used 'numPUs' based on the "plural" argument, would that mean that a query asking about the number of VIP people would be written There was also a question about whether even considering such questions was inappropriate since it seemed to be reversing a decision that had been made (where, personally, I don't view these proposals as being reversing so much as refining). I also don't think we should be slavish to decisions we've made if, upon applying it in practice, we end up with results that we don't actually like. I.e., we should be able to question or refine decisions if there are significant hesitations, so long as it doesn't result in thrashing. |
Cross post from here, but figured I should also keep this with the main conversation: I think it's reasonable to just treat |
…e-fac Update standard module style guide This PR updates StandardModuleStyle.rst per discussions in issues #14291 and #20240. We might change our mind about the capitalization rule but #20699 will add to this PR for that & it's reasonable to have the general guidance written down even if we are going to adjust it in the future. Reviewed by @lydia-duncan and @daviditen - thanks!
What should be the naming convention for names containing acronyms/initialisms? It was discussed briefly in #6698 (comment) and #17936 but there wasn't a conclusion.
The example given there was: How should
render_html_dom()
be camel-cased?renderHtmlDom()
orrenderHTMLDOM()
?Should there be special rules for short acronyms? Acronyms at the end the symbol name? Any other special cases?
The text was updated successfully, but these errors were encountered: