interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))
Tim Penhey
tim.penhey at canonical.com
Wed May 28 00:24:10 UTC 2014
On 28/05/14 11:46, William Reade wrote:
> Re unsafe: where we can't check equality, we fall back on identity. We
> know it's a hack; and if it's fundamentally broken, we'd like to know
> why, so we can fix it. Please clarify your objections.
I do have a question around this and it is one that I have asked a
number of people and not got a clean answer, apart from what we have
implemented.
I talked with Dave about interface identity, and the underlying problem
is that I have one interface, and I want to know if it is the same as
another interface.
Note that this isn't equality, but identity. This appears to me to be a
current deficiency in the Go language in that there is no way to ask this.
I'm hoping that Go will add something, and we can remove the 'orrible
'ack that we have in place now.
The issue is that an interface can be satisfied by both pointer and
value types, and that some value types are not comparable, so equality
fails.
Does anyone else know of a reliable way to test for identity?
Cheers,
Tim
More information about the Juju-dev
mailing list