5 ms·
The language design choice to use capitalization instead of a public/private keywords is, in my opinion, a poor one. It seems like they've made choices to minim
by andyfleming 9y ago
The language design choice to use capitalization instead of a public/private keywords is, in my opinion, a poor one. It seems like they've made choices to minimize keywords rather than be explicit and intuitive.
I'm not saying that it can't be learned/taught. Also, IDEs like GoLand help, but at the end of the day the capitalization approach seems like an unnecessary annoyance
- tschellenbach 9y agoPython does something similar with the _hidden __morehidden syntax. Some people will like the syntax, others won't. It doesn't really change anything about what you can achieve with Go.
- pdpi 9y agoIt's awkward but can absolutely be learned and taught. What makes it really idiotic is that the spec literally ties visibility to a single, specific unicode character class. This has the hilarious effect that, for example, Latin, Greek, Cyrillic identifiers are allowed to be public, but Arabic, Korean (Hangul) or Thai are not!
- s17n 9y agoNope, the point is consistency in large organizations. In other languages, teams develop naming conventions like these. Having them in the language reduces the overhead of reading a new codebase.
- andyfleming 9y agoThere's a difference between consistent code style and forced language conventions. Also, I'm not sure you'll be able to convince me that reading "public" and "private" add meaningful cognitive load to reading code.
- s17n 9y agoRight, the difference is that the former isn’t real. When you have millions to billions of LoC developed by thousands to hundreds of thousands of developers anything not forced isn’t going to be consistent.
- andyfleming 9y agoYou can enforce code style through linting and CI. In some projects I've worked on, code doesn't get merged if it doesn't pass code style checks.