News for hackers. Stuff that matters.
Re:Go generics draft design: building a hashtable by sacado2 on Wednesday June 17, 2020 @06:21PM (#23557506)
You can only add methods on types that were defined in the current package. As a consequence, you can't add methods to built-in types. But that's rarely something you want to do anyway (I can't think of a real-world situation where it would be useful), what would make sense is creating a new string type, and add methods to it:

    type myInt int

    func (mi myInt) f() myInt { ... }

There are no comments on this comment yet.