Thank you for the reply. I didn’t see a “report” feature on the “Go Tour”. Double checked after disabling everything on chrome that might block anything.
I have no doubt I’ll get “used to it”, but it’s a completely different course change compared to several major other languages I’ve used. It’s part of the lexical DNA, how the language operates and it’s a topic barely glanced at in any documentation, including the links offered. There’s no contextual glue. It feels like that uneven step in front of the hall newcomers trip on with an improper sign.
https://golang.org/doc/effective_go.html
(#names)
“Names are as important in Go as in any other language. They even have semantic effect: the visibility of a name outside a package is determined by whether its first character is upper case. It’s therefore worth spending a little time talking about naming conventions in Go programs.”
(#Exported_identifiers)
"An identifier may be exported to permit access to it from another package. An identifier is exported if both:
the first character of the identifier’s name is a Unicode upper case letter (Unicode class “Lu”); and
the identifier is declared in the package block or it is a field name or method name.
All other identifiers are not exported."
A commented example is a lot more crystal clear. Could offer more examples. May seem silly, but the difference in is staggering.
// Foobar.foo & Foobar.bar and function Add have "private scope"; ONLY the package can directly access it
type Foobar struct {
foo int
bar int
}
func add(x int, y int) int {
return x + y
}
// Foobar.Foo & Foobar.Bar and function Add have "public scope"; ANYTHING can directly access it
type Foobar struct {
Foo int
Bar int
}
func Add(x int, y int) int {
return x + y
}
Would be much better a reserved word, especially since it’s even stressed under “Minimize the exported interface” (https://blog.golang.org/organizing-go-code)
“The larger the interface you provide, the more you must support. Users will quickly come to depend on every type, function, variable, and constant you export, creating an implicit contract that you must honor in perpetuity or risk breaking your users’ programs.”
For me, it’s a big negative mark on the language. Is there even a way of quickly identifying exports (reliably without regex) via a text search or some inquiry using “go list”? Would be if there’s a reserved word for it.
Can live with it, but fix the signage or the step. Given it’d have an arduous ripple effect throughout the community, I’d lean towards the signage. Make it a more prominent topic throughout most of the documentation. Constantly pounding the idea that “if you lead anything with a Capital letter, it’s open to the world, it is public”.