5 ms·
> (assuming, of course, that Go accepts Reader as a valid subtype of ReaderCloser (i would hope so!)). Yes it does: http://play.golang.org/p/OnBotL9zfF http://
by exch 13y ago
> (assuming, of course, that Go accepts Reader as a valid subtype of ReaderCloser (i would hope so!)).
Yes it does: http://play.golang.org/p/OnBotL9zfF http://play.golang.org/p/OnBotL9zfF
- epidemian 13y agoThanks for the example. Playing with the example a little bit left me with a nice feeling about Go's structural typing: - Passing a ReaderCloser reference to a function that expects a Reader is possible: http://play.golang.org/p/PZCKvmp5Sj http://play.golang.org/p/PZCKvmp5Sj - Composing interfaces, though very useful, is not required in order to make one a proper subtype of the other: http://play.golang.org/p/fXn0zzM60D http://play.golang.org/p/fXn0zzM60D