logoalt Hacker News

aatd86last Friday at 4:30 PM1 replyview on HN

When you want to abstract on structs "having" a given field (by name) of a given type, I think. Although that may come in Go at some point.


Replies

tineslast Friday at 4:43 PM

I'm not a Go expert but that's exactly what interfaces are, aren't they? In Go a struct automatically implements an interface if it contains all the required fields (duck-typing).

show 3 replies