interface identity (was Re: Proposed new dependency: github.com/juju/errors (and github.com/juju/errgo))
Nate Finch
nate.finch at canonical.com
Wed May 28 16:39:16 UTC 2014
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 <tim.penhey at canonical.com>wrote:
> 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 also change the meaning of cause, so a nil
> cause means get the cause from the previous (underlying) error.
>
> Do you not agree with me though that in the general Go language there
> should be a way to check identity? Or do you not agree?
>
> Tim
>
> >
> > On May 27, 2014 8:48 PM, "Tim Penhey" <tim.penhey at canonical.com
> > <mailto:tim.penhey at 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.
> >
> > There seems to be no clean way to do this.
> >
> > Tim
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20140528/d5ecd52e/attachment-0001.html>
More information about the Juju-dev
mailing list