I don’t believe your example is correct. In order for a current wrapper to call 
Flush on Close on the bufio.Writer the Close would need to be defined on the 
Wrapper struct so there would be no name collision. 

I think it is best to see the proposal before commenting. I plan on addressing 
any code breaking issues - if there were obvious ones I wouldn’t be for the 
proposal either. 

> On May 23, 2019, at 6:14 AM, roger peppe <rogpe...@gmail.com> wrote:
> 
> I have to say that I must prefer APIs that do not take arbitrary advantage of 
> dynamically discovered methods. It makes things less clear, and adding a 
> wrapper to flush and then close the underlying writer is not hard. In fact 
> the idiom for doing so is probably the reason why it's not feasible to add a 
> Close method to `bufio.Writer`. If you do that, then you run the risk of 
> breaking current code that adds its own Close method:
> 
> https://play.golang.org/p/xidNo2Z_OYB
> 
> This would definitely break some code that I've written.
> 
>    cheers,
>       rog.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/93D441AB-D98F-48F6-8BCA-E555F98919DC%40ix.netcom.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to