Better HN
topnewbestaskshowjobs
Log inSign up

urzaj

4 karma · joined Nov 19, 2022 (4y ago) · 1 submissions

Submissions

comment 4y ago · link · parent

From 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