urzaj·4년 전·discussFrom the go FAQ:> Why is len a function and not a method?> We debated this issue but decided implementing len and friends as functions was fine in practice and didn't complicate questions about the interface (in the Go type sense) of basic types.I imagine similar reasoning applies to "clear" here.https://go.dev/doc/faq#methods_on_basics
> Why is len a function and not a method?
> We debated this issue but decided implementing len and friends as functions was fine in practice and didn't complicate questions about the interface (in the Go type sense) of basic types.
I imagine similar reasoning applies to "clear" here.
https://go.dev/doc/faq#methods_on_basics