FAQ
Ok, aha moment I hope ...
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

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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 13 of 19 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 27, '15 at 10:48p
activeAug 29, '15 at 1:56a
posts19
users7
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase