Why exceptions for error handling is so important

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 13:34:19 PST 2015


On Monday, 12 January 2015 at 20:32:59 UTC, deadalnix wrote:
> On Monday, 12 January 2015 at 13:33:40 UTC, John Colvin wrote:
>> On Monday, 12 January 2015 at 11:09:01 UTC, Walter Bright 
>> wrote:
>>> On 1/12/2015 3:02 AM, Tobias Pankrath wrote:
>>>> As far as I understand is, it requires each component to 
>>>> settle on the same
>>>> discriminated union that packs the error and result, which 
>>>> he calles Result but
>>>> is usually Choice in F#.
>>>>
>>>> Now in D we use the opDot to chain components, which works 
>>>> since we have UFCS.
>>>> In F# there a simply three different opDots: >>, >>= and >=> 
>>>> which take care of
>>>> the adaption.
>>>
>>> Or we could just use exceptions, which require none of that.
>>
>> Interesting little rant about exceptions (and more), from the 
>> author of a large and successful project in C++     
>> http://250bpm.com/blog:4
>
> Exception in C++ is different. It is full of pitfalls and 
> generally a usability disaster. I can understand that C++ dev 
> do not like exception, but that say more about C++ than it does 
> about exceptions.

Back when C++ got exceptions I never understood why so much paper 
was being wasted explained them, with articles on "The C/C++ 
Users Journal" and "C++ Report".

Having learned exceptions in more sane languages, they just felt 
natural to me.

But then it hit me, many of the issues are caused by the 
compatibility with C semantics and the pay only for what you use 
mantra.

--
Paulo


More information about the Digitalmars-d mailing list