3 ms·
is a field named "ß" private or public? Or ĸ?
by kuschku 10y ago
is a field named "ß" private or public? Or ĸ?
- js2 10y agoAn identifier is exported if both: 1. the first character of the identifier's name is a Unicode upper case letter (Unicode class "Lu"); and 2. the identifier is declared in the package block or it is a field name or method name. All other identifiers are not exported. https://golang.org/ref/spec#Exported_identifiers https://golang.org/ref/spec#Exported_identifiers Both of the characters you asked about are lowercase: http://www.fileformat.info/info/unicode/char/00df/index.htm http://www.fileformat.info/info/unicode/char/00df/index.htm http://www.fileformat.info/info/unicode/char/0138/index.htm http://www.fileformat.info/info/unicode/char/0138/index.htm Here's the full list of Lu characters: http://www.fileformat.info/info/unicode/category/Lu/list.htm http://www.fileformat.info/info/unicode/category/Lu/list.htm
- barsonme 10y agoHere are the rules: https://golang.org/ref/spec#Exported_identifiers https://golang.org/ref/spec#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.
- skj 10y agoDefinitely one or the other, but the confusion means it's best practice to avoid fancy letters for identifiers.
- kuschku 10y agoWell, there's people writing code in other languages. I know in Japan and Germany it's still kinda common for larger companies to build codebases in local languages. Which in turn can lead to these issues.