Why exceptions for error handling is so important
Paulo Pinto via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 13 03:56:00 PST 2015
On Monday, 12 January 2015 at 19:32:22 UTC, Andrei Alexandrescu
wrote:
> On 1/12/15 11:30 AM, Russel Winder via Digitalmars-d wrote:
>>
>> On Mon, 2015-01-12 at 10:43 -0800, H. S. Teoh via
>> Digitalmars-d wrote:
>>>
>> […]
>>> And what exactly should operator[] return if a key wasn't
>>> found?
>>>
>> […]
>>
>> Go has an interesting solution, key lookup in a map return a
>> pair
>> (result, ok), if lookup succeeded then result is the
>> associated value,
>> if ok is false then result is undefined. I quite like this.
>
> How can you like undefined? That's a terrible solution again
> underlining Go's conflation of union and product types. --
> Andrei
They posted recently a blog post about error handling in Go.
https://blog.golang.org/errors-are-values
--
Paulo
More information about the Digitalmars-d
mailing list