I'm just wondering why the string functions in Google Go are defined in the package strings, and not in the type itself string. They could easily do
func (s string) ToUpper() string {
}
instead of the current
func ToUpper(s string) string {
}
in the package strings.
I assume that if you want to implement a custom version ToUpperfor a custom type that extends string(i.e. type MyString string), you no longer have access to the built-in ToUpperon that type, but I cannot find support.
source
share