(btw, I'm obviously still reading this thread :) Thanks for the replies)

On Mon, Apr 3, 2017 at 11:25 PM, Axel Wagner <axel.wagner...@googlemail.com>
wrote:

> Hi,
>
> On Mon, Apr 3, 2017 at 11:02 PM, Kevin Powick <kpow...@gmail.com> wrote:
>
>> Check the error value.  If an error is present, all bets are off with
>> regard to any of the return values.  It's simple, explicit and consistent.
>>
>
> I've said it at least 5 times in this thread alone but: No one is actually
> arguing this point (no matter how much some people seem to insist we do).
>
> The idea that "sometimes" an API call will return values that "may" be
>> helpful, or partially useful, is a recipe of disaster.
>>
>
> This is even further from what anyone is suggesting, than the normal level
> of misunderstanding on this topic. If anything, the idea is to
> *relatively* (!!!)ยน consistently return the most unhelpful value possible.
>
>
>> Yes, some will ignore or forget to check the error value and their
>> programs may continue to work (until they blow up)
>>
>
> The idea is to prevent this by putting at least some effort into returning
> obviously and intentionally invalid values that blow up immediately. It's
> exactly the opposite of what you are arguing against.
>
>
>> If anyone writing an API want's to help the users of their APIs, then
>> provide meaningful, detailed information in any returned error.
>>
>
> Again, not debated here, even in the slightest.
>
>
> Again, the example from above should give some indication of what the
> question is: In the case, that a function has a value partially initiated
> when an error occurs, should it a) return a fully invalid value (be it nil,
> the zero value of a primitive type or the zero value of a struct) even if
> that means adding an extra branch or so and maybe an instruction or two, or
> b) just return the partially initiated value.
>
> The argument is, that a) will help a developer, that forgets to check the
> error, to discover and fix the bug more quickly and that it does very
> little harm.
>
>
> [1] if anyone suggests again that I intend to make this part of an API
> contract, I'll scream.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to