3 ms·
> When you run into a case where you want to add a method to an existing interface, you may be able to follow this strategy. Start by creating a new interface w
by poorman 6y ago
> When you run into a case where you want to add a method to an existing interface, you may be able to follow this strategy. Start by creating a new interface with your new method, or identify an existing interface with the new method. Next, identify the relevant functions that need to support it, type check for the second interface, and add code that uses it.
I like this pattern, and I have used it. The issue I have is when I look at the generated godoc, the original interface is in the signature. I don't know the function accepts the new interface as well without either digging into the code or a comment for the function.
- ElCampechano 6y agoHow did you solve the pattern of not having generics in the language?
- swagonomixxx 6y agoTry this: https://www.reddit.com/r/rust/comments/5penft/parallelizing_enjarify_in_go_and_rust/dcsgk7n/ https://www.reddit.com/r/rust/comments/5penft/parallelizing_...
- anonymoushn 6y agoIt seems like this convention invites us to create this sort of issue more times: https://news.ycombinator.com/item?id=6060351 https://news.ycombinator.com/item?id=6060351