3 ms·
Can you articulate why? it seems to me that 'feel' should not be part of the discussion.
by tomjen3 6y ago
Can you articulate why? it seems to me that 'feel' should not be part of the discussion.
- deleted 6y ago[deleted]
- juststeve 6y agoNot GP but: It may frustrate coworkers who need to edit the code. It adds another dependency into your workflow.
- lenish 6y agoNot GP, but I've sometimes found libraries implementing similar concepts differently causing issues. E.g. libraryA.Result struct { Err error Data SomeDataType } libraryB.Result struct { err string Data SomeDataType } func (r libraryB.Result) Error() string { return r.err } Now you have two different implementations of the same fundamental idea, but they each require different handling. In Go, where many things simply return an error type in addition to whatever value(s), you would now have three different approaches to error handling to deal with as opposed to just whatever the language specified as the best practice.
- mrkeen 6y agoThis is what interfaces are for. Let your caller bring their own error type and instantiate your library code over that.