interface in a struct is not understood correctly. The original
understanding of this (or at a least side-effect of it) was that embedding
an interface in a struct would ensure that the struct implements the
interface. If the struct did not implement the interface, a compilation
error would occur to notify me that the struct does not implement the
interface any longer.
This behavior might have changed from pre-go1 to go1 because I could have
sworn that this was the case at some point in time. The scenario that
occurred was: an interface that I have been using for some time now needed
a method added to it. Once the method was added, I expected to see several
compilation errors notifying me which structs embed the interface and do
not implement any longer. The program executed without any problem until
the new method was called on a passed type-assertion with a struct that did
not implement the method.
What is the point of embedding an interface inside a struct? Is there any?
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.