Skip to content
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

wiki: Clarify meaning of mixed caps #23600

Closed
fulldecent opened this issue Jan 29, 2018 · 4 comments
Closed

wiki: Clarify meaning of mixed caps #23600

fulldecent opened this issue Jan 29, 2018 · 4 comments

Comments

@fulldecent
Copy link

In https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps, reference is made to mixed caps. As currently written, this leaves room for interpretation. Please clarify which of the following is preferred:

  • xmlHttpRequest
  • XMLHTTPRequest
  • xmlHTTPRequest
@dominikh
Copy link
Member

Is the existing documentation at https://github.com/golang/go/wiki/CodeReviewComments#initialisms not sufficient?

@fulldecent
Copy link
Author

fulldecent commented Jan 29, 2018

The definition for mixed caps is just:

See https://golang.org/doc/effective_go.html#mixed-caps. This applies even when it breaks conventions in other languages. For example an unexported constant is maxLength not MaxLength or MAX_LENGTH.

and, by the URL reference:

Finally, the convention in Go is to use MixedCaps or mixedCaps rather than underscores to write multiword names.

The initialisms note is:

Words in names that are initialisms or acronyms (e.g. "URL" or "NATO") have a consistent case. For example, "URL" should appear as "URL" or "url" (as in "urlPony", or "URLPony"), never as "Url". Here's an example: ServeHTTP not ServeHttp.


So parsing this, I think:

# Step one: no casing

xmlhttprequest
--------------

# Step two: mixed case rule says:
xmlHttpRequest
---*---*------

# Step three: initialism rule says to fix violation in word two:
xmlHTTPRequest
----***-------

If this is correct, great, I think this example would be good to put in the wiki (just the result).

@fulldecent
Copy link
Author

Thank you!

@mikioh mikioh changed the title Clarify meaning of mixed caps wiki: Clarify meaning of mixed caps Jan 30, 2018
@golang golang locked and limited conversation to collaborators Jan 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants