Dave Cheney

Results 267 comments of Dave Cheney

Thank you for raising this issue. You've written a lot, and I apologise up front that I have not been able to distil this into a single request. If my...

1. Interfaces should be defined by the caller, not the implementer. If you need an interface e decl, decl it in your own package to reduce coupling. 2. Similarly. If...

> 1&2: I'd never considered that, I suppose because I see so many interfaces defined close to where they are implemented. I'm not sure yet what I think about making...

@veqryn i'm sorry, that was my misunderstanding. I think what you are looking for is something like a type switch ``` switch err := errors.Cause(err).(type) { case *MyError: // handle...

@solher opaque error handling means the caller of a function that returns an error does not customise it's behaviour depending on the _value_ or _type_ of the error returned; it...

If you want the caller to change its behaviour on what is returned in the error value, yes. If you can avoid altering your behaviour, using opaque errors, this is...

Honestly don’t remember. I can’t think of a reason why it was don’t that way.

Is the bug that the Cause implmentation on myCodedError returns whatever is in its err field without checking it is nil? Could this be solved by changing the contract on...

I think this would be ok; - we tighten the contract for Causer.Cause and say if it is present on a type it _must_ return an error - or, we...

Not necessarily; errors.New does not return an error with a Cause. > On 21 Oct 2017, at 01:33, Travis wrote: > > That looks good to me. If I'm reading...