I dislike this design, here is why:
- interop with JSON, you need those meta to translate your Upper case properties to lower case
- interop with Java, vim jump not working because of OnEvent, in Java is onEvent
Actually I suggest leave those freedom, say:
- any method start with Upper or lower case should be public
- any method start with ___ should be private
Anybody has the same pain with this?
No. And I don’t think it is worth to discuss this point. There are many good reasons for how the Go way of names. Just one link to get you started: https://www.goinggo.net/2014/03/exportedunexported-identifiers-in-go.html
- IMO you should never just accept an identifier from JSON directly: do a proper mapping.
- we don’t need Java interop - leave that to the JAVA based languages.
Particularly on that second item that kind of contract between different languages is a bad code smell. Language A should neither know nor care how language B decides to name its internal variable, or what is private or public. Not only is that too strict of coupling, it leads to people writing language B in language B. Always use the native idioms of a language rather than trying to force it into a different language.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.