<p dir="ltr">I think we need concrete examples which Tim should have in the test suite.</p>
<p dir="ltr">John<br>
=:-></p>
<div class="gmail_quote">On May 28, 2014 6:50 AM, "Andrew Wilkins" <<a href="mailto:andrew.wilkins@canonical.com">andrew.wilkins@canonical.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 28, 2014 at 10:39 AM, John Meinel <span dir="ltr"><<a href="mailto:john@arbash-meinel.com" target="_blank">john@arbash-meinel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">The address of the real value is the same.</p></blockquote><div>Are you referring to the backing array? That is not what is being compared, so that's not a useful property.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">John<br>
=:-></p>
<div class="gmail_quote"><div><div>On May 28, 2014 6:04 AM, "Andrew Wilkins" <<a href="mailto:andrew.wilkins@canonical.com" target="_blank">andrew.wilkins@canonical.com</a>> wrote:<br type="attribution">
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 28, 2014 at 9:52 AM, Tim Penhey <span dir="ltr"><<a href="mailto:tim.penhey@canonical.com" target="_blank">tim.penhey@canonical.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 28/05/14 13:48, Andrew Wilkins wrote:<br>
> On Wed, May 28, 2014 at 8:47 AM, Tim Penhey <<a href="mailto:tim.penhey@canonical.com" target="_blank">tim.penhey@canonical.com</a><br>
</div><div>> <mailto:<a href="mailto:tim.penhey@canonical.com" target="_blank">tim.penhey@canonical.com</a>>> wrote:<br>
><br>
> On 28/05/14 12:43, Nate Finch wrote:<br>
> > This sounds like one of those "if you have to ask this question,<br>
> you're<br>
> > doing something wrong".<br>
> ><br>
> > Can you give an example of where we need this?<br>
><br>
> Sure... let's say we have a stack of errors, for simplicity of the<br>
> argument lets say it is a slice of error interface values.<br>
><br>
> stack []error<br>
><br>
> * an error is pushed on to the stack initially, we now have one error<br>
> * the same error is pushed (or appended - I don't care)<br>
> * we now have the same error twice<br>
> * I push a new error on the stack, so it looks a little like this<br>
> [err1, err1, err2] right?<br>
><br>
> Now iterating through this slice I want to know when the error changes.<br>
><br>
><br>
> Can you explain where equality fails?<br>
<br>
</div>Equality fails when the interface is satisfied by a non-comparable value<br>
type, like a struct with a slice in it.</blockquote><div><br></div><div>I see. In that case, I guess you'd have to use reflect.DeepEquals to collapse arbitrary errors.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
> I guess you're thinking you'd like to do something like "x is y" in<br>
> Python. There's no such thing as objects in Go, so no universal<br>
> definition of identity either.<br>
<br>
</div>But an interface is effectively two pointers, one to the type and one to<br>
the thing that satisfies the interface. Identity in that case is pretty<br>
simple.<br></blockquote><div><br></div><div>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.</div></div></div></div>
<br></div></div><div>--<br>
Juju-dev mailing list<br>
<a href="mailto:Juju-dev@lists.ubuntu.com" target="_blank">Juju-dev@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju-dev" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju-dev</a><br>
<br></div></blockquote></div>
</blockquote></div><br></div></div>
</blockquote></div>