On Friday, August 28, 2015 at 12:31:55 AM UTC-7, Jesse McNelis wrote:
There is no spooky at a distance action. The decision about whether a
type implements an interface is based on the type's method set.
http://golang.org/ref/spec#Method_sets
There is no spooky at a distance action. The decision about whether a
type implements an interface is based on the type's method set.
http://golang.org/ref/spec#Method_sets
That has been my understanding. But, it is not quite complete, though in
hindsight the missing bit does seem obvious.
That "decision of whether X implements Y" is evaluated only at the point of
assignment. That makes it sound like a run-time evaluation, but Go
apparently evaluates it at compile-time and at every assignment that
depends on whether X implements Y. Different assignments -- pointer or
value -- can result in different evaluations of whether X implements Y.
Absent an assignment, there is simply no relationship between X and Y -- Go
has no 'extends' or 'implements'.
So, no spooky action at a distance - the variable assignment is the action.
--
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/d/optout.