Which is a big problem with the Go “interface” specification… 

But the de-facto standard is as I stated - if it implements the method it 
implements the interface. There is no requirement that the method/struct “be 
documented” to be an implementor - buyer beware!

We is also why you should never use method names that collide with “stdlib 
interfaces” unless you intend them to have the same semantics.

> On May 12, 2019, at 8:58 PM, Dan Kortschak <d...@kortschak.io> wrote:
> 
> This is not quite true. The language itself doesn't make claims other
> than types and method names. However, there are conventions around the
> semantics of methods in an interface. For example, a Read method that
> returns 0, nil is allowed for io.Reader, but frowned upon unless the
> buffer is zero length, and a Read method that fills the buffer with n
> bytes and returns n-1 (or n+1), nil is not a correct implementation of
> io.Reader. Nor is an implementation correct if it retains the buffer.
> 
> Just as the BDNF is not a complete definition of the grammar of the
> language, interface type decls are not complete definitions of
> interfaces.
> 
> This is why I am asking.
> 
> On Sun, 2019-05-12 at 20:16 -0500, robert engels wrote:
>> There is no claim because that is not how Go interfaces work
> 
> -- 
> 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/1557712717.21310.68.camel%40kortschak.io.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/AFA2FB88-1EA6-44BA-8E3F-A3812633F301%40ix.netcom.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to