I think we need concrete examples which Tim should have in the test suite. John =:-> On May 28, 2014 6:50 AM, "Andrew Wilkins" <andrew.wilk...@canonical.com> wrote:
> On Wed, May 28, 2014 at 10:39 AM, John Meinel <j...@arbash-meinel.com>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" <andrew.wilk...@canonical.com> >> wrote: >> >>> On Wed, May 28, 2014 at 9:52 AM, Tim Penhey <tim.pen...@canonical.com>wrote: >>> >>>> On 28/05/14 13:48, Andrew Wilkins wrote: >>>> > On Wed, May 28, 2014 at 8:47 AM, Tim Penhey <tim.pen...@canonical.com >>>> > <mailto:tim.pen...@canonical.com>> 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, for simplicity of the >>>> > argument lets say it is a slice of error interface values. >>>> > >>>> > stack []error >>>> > >>>> > * an error is pushed on to the stack initially, we now have one >>>> error >>>> > * the same error is pushed (or appended - I don't care) >>>> > * we now have the same error twice >>>> > * I push a new error on the stack, so it looks a little like this >>>> > [err1, err1, err2] right? >>>> > >>>> > Now iterating through this slice I want to know when the error >>>> changes. >>>> > >>>> > >>>> > Can you explain where equality fails? >>>> >>>> Equality fails when the interface is satisfied by a non-comparable value >>>> type, like a struct with a slice in it. >>> >>> >>> I see. In that case, I guess you'd have to use reflect.DeepEquals to >>> collapse arbitrary errors. >>> >>> > I guess you're thinking you'd like to do something like "x is y" in >>>> > Python. There's no such thing as objects in Go, so no universal >>>> > definition of identity either. >>>> >>>> But an interface is effectively two pointers, one to the type and one to >>>> the thing that satisfies the interface. Identity in that case is pretty >>>> simple. >>>> >>> >>> If the pointer is the same, which it won't be if you're storing a slice >>> in an interface; slices are wider than pointers. >>> >>> -- >>> Juju-dev mailing list >>> Juju-dev@lists.ubuntu.com >>> Modify settings or unsubscribe at: >>> https://lists.ubuntu.com/mailman/listinfo/juju-dev >>> >>> >
-- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev