-
Notifications
You must be signed in to change notification settings - Fork 18
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 doesn't follow Go style for initialisms #13
Comments
It was a deliberate design decision to stick to the jQuery-isms as close as possible: This is the reasoning behind it, it is not a "hard" decision which can not be changed. How would you handle the get/set scenario in idiomatic Go Style ? ///javascript code:
var gotHtml = $("#someid").html();
var jQueryInstance = $("#someid").html("<b>some html</b>"); And last: would you like to give up non-idiomatic (from a Go point of view) jQuery chaining of method calls ? It makes your code succinct. |
I guess that is a defensible stance, but who is your target audience? i imagine that people who are accustomed to Go are going to find GopherJS more interesting than people that are fluent in JS. If you are accustomed to Go, the inconsistent naming is jarring. |
You didn't yet answer my questions. Regarding your question: Target audience are people with jQuery know-how. Googling for "jQuery" gives 65 700 000 hits, for "Golang" I get 370 000 hits. The jQuery binding is out for some time and nobody complained about that so far, until more people show up with the same opinion I propose to stick to the current approach. |
I think we misunderstand each other. My suggestion is to use the name SetHTML rather than the current SetHtml. Similar for other names with abbreviations. |
What I found strange is that the topic on "initialisms" does not appear in Effective Go but https://golang.org/doc/effective_go.html#mixed-caps What about other bindings, like for example: I propose to discuss this point upstream in the gopherjs project. For now on my ToDo list are:
|
Maybe effective Go should also be updated, but the precedent in the standard lib is clearly there. See eg. function names in https://golang.org/pkg/crypto/rsa/ https://godoc.org/honnef.co/go/js/dom looks to follow the standard. It says HTML rather than Html. https://godoc.org/github.com/gopherjs/gopherjs/js has no initialisms. Overall, the gopherjs package looks clean, except for https://godoc.org/github.com/gopherjs/gopherjs/compiler/typesutil where it says Js rather than JS |
I can see now, the rsa library is a good showcase. Looking over the Api at https://godoc.org/github.com/gopherjs/jquery are the more Initialisms than "CSS" and "HTML" ? |
CSS and HTML are the only initialisms I see now that are not already all-caps. We have several instances where these are already caps ( I might suggest supporting both names in this library, where jQuery uses CamelCase. Even if the decision were made to stick with Go-style initials, this might be wise for backward compatibility, any way.
|
hey,
a nitpick I noticed when looking at JQuery: some of the naming doesn't follow Go style for initialisms
https://github.com/golang/go/wiki/CodeReviewComments#initialisms
examples that go against this: SetHtml(), Css(), Html() etc.
The text was updated successfully, but these errors were encountered: