interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Tim Penhey
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 ha

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Nate Finch
This sounds like one of those "if you have to ask this question, you're doing something wrong". Can you give an example of where we need this? On May 27, 2014 8:24 PM, "Tim Penhey" wrote: > On 28/05/14 11:46, William Reade wrote: > > Re unsafe: where we can't check equality, we fall back on iden

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Tim Penhey
On 28/05/14 12:43, Nate Finch wrote: > This sounds like one of those "if you have to ask this question, you're > doing something wrong". > > Can you give an example of where we need this? Sure... let's say we have a stack of errors, for simplicity of the argument lets say it is a slice of error i

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Nate Finch
If you're talking about errgo, if all we care about is transition, but not what the actual types are, we could just record in the list when we mask the type. On May 27, 2014 8:48 PM, "Tim Penhey" wrote: > On 28/05/14 12:43, Nate Finch wrote: > > This sounds like one of those "if you have to ask t

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Tim Penhey
On 28/05/14 13:31, Nate Finch wrote: > If you're talking about errgo, if all we care about is transition, but > not what the actual types are, we could just record in the list when we > mask the type. We could, but that would mean walking the list every time you want to check the cause. It would

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Andrew Wilkins
On Wed, May 28, 2014 at 8:47 AM, Tim Penhey wrote: > On 28/05/14 12:43, Nate Finch wrote: > > This sounds like one of those "if you have to ask this question, you're > > doing something wrong". > > > > Can you give an example of where we need this? > > Sure... let's say we have a stack of errors,

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Tim Penhey
On 28/05/14 13:48, Andrew Wilkins wrote: > On Wed, May 28, 2014 at 8:47 AM, Tim Penhey > wrote: > > On 28/05/14 12:43, Nate Finch wrote: > > This sounds like one of those "if you have to ask this question, > you're > > doing something wrong". >

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Andrew Wilkins
On Wed, May 28, 2014 at 9:52 AM, Tim Penhey wrote: > On 28/05/14 13:48, Andrew Wilkins wrote: > > On Wed, May 28, 2014 at 8:47 AM, Tim Penhey > > wrote: > > > > On 28/05/14 12:43, Nate Finch wrote: > > > This sounds like one of those "if you have to ask th

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread John Meinel
The address of the real value is the same. John =:-> On May 28, 2014 6:04 AM, "Andrew Wilkins" wrote: > On Wed, May 28, 2014 at 9:52 AM, Tim Penhey wrote: > >> On 28/05/14 13:48, Andrew Wilkins wrote: >> > On Wed, May 28, 2014 at 8:47 AM, Tim Penhey > > > wrote:

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Andrew Wilkins
On Wed, May 28, 2014 at 10:39 AM, John Meinel wrote: > The address of the real value is the same. > Are you referring to the backing array? That is not what is being compared, so that's not a useful property. > John > =:-> > On May 28, 2014 6:04 AM, "Andrew Wilkins" > wrote: > >> On Wed, May 28,

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread John Meinel
I think we need concrete examples which Tim should have in the test suite. John =:-> On May 28, 2014 6:50 AM, "Andrew Wilkins" wrote: > On Wed, May 28, 2014 at 10:39 AM, John Meinel wrote: > >> The address of the real value is the same. >> > Are you referring to the backing array? That is not wh

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-27 Thread Tim Penhey
On 28/05/14 15:48, John Meinel wrote: > I think we need concrete examples which Tim should have in the test suite. > > John > =:-> > > On May 28, 2014 6:50 AM, "Andrew Wilkins" > wrote: > > On Wed, May 28, 2014 at 10:39 AM, John Meinel > mailto:j...@

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-28 Thread roger peppe
I just saw this thread after replying to the other one. Fundamentally, I think comparing errors for equality is misguided. That said, a simple approach that doesn't use DeepEquals is possible: func sameError(e1, e2 error) bool { defer func() { recover() }() return e1 == e2 } On 28 May 201

Re: interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))

2014-05-28 Thread Nate Finch
I haven't seen any code or a description of what you're doing, so it's really hard for me to help. Broadly, what are you trying to accomplish? Maybe we can help avoid the need to do something that Go doesn't support well. On Tue, May 27, 2014 at 9:43 PM, Tim Penhey wrote: > On 28/05/14 13:31,