4 ms·
Methods can always be added. Yes the values and types can't be changed but we can extend the existing types to have these methods and give naked error values (e
by uluyol 10y ago
Methods can always be added. Yes the values and types can't be changed but we can extend the existing types to have these methods and give naked error values (errors.New) new types. It wouldn't be breaking the Go1 guarantee because they would still have the type error, only the underlying type would change.
- fauigerzigerk 10y agoAll true, I never said anything different. But what's the point of adding methods? What you can't do is add call specific information to errors returned from a particular function if that function returned a package level singleton value before.
- uluyol 10y agoI see. This isn't always true, many places in the standard library do not document what error they will return. Changing these wouldn't violate the Go1 guarantee either. I see that other people have made the argument in support of Dave Cheney's approach already so I won't repeat it.
- fauigerzigerk 10y agoIs there a commitment by the Go team to adopt Dave Cheney's approach for the standard library?