Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
amourdezombi
· 13y ago · 0 comments
One thing that hasn't been articulated in the recent HN articles about Go: method sets can be defined for _any_ type, not just structs.
Comments
[–]
mseepgood
13y ago
Yes, you can even attach a method to a function type.
[–]
dsymonds
13y ago
Any
named
type. You can't stick a method on []string; you have to name it first, then add methods to its name (T or *T).