|
|
|
|
|
by jayd16
2436 days ago
|
|
>It's not inheritance of any kind because the outer struct cannot be passed into a function that takes the inner element type My mistake. I was mislead by the blog post. From the article: > The new type would be interchangeable with the existing client which would minimize the need for changes to existing code. So with go exported structs it is not fair to say they can be used interchangeably if at any point that instance is used as a parameter, field, or variable that defines the type? In the examples given in the article, the thing that is used as parameters is the interface Client not the concrete type HTTPClient. Would that not allow CachedHTTPClient to passed around as if it was a Client and would that not show the same issues as inheritance? |
|