Google's Go

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jan 23 14:47:50 PST 2010


Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> Walter Bright wrote:
>>> Since the default handling for exceptions is to print a pretty 
>>> message, like "cannot open file xxxxx", for many utility programs 
>>> that is all you need. You don't have to write any error handling 
>>> code, and yet your program handles errors correctly and gracefully 
>>> reports them to the user.
>>
>> I wouldn't go that far. Unfortunately, writing even exception-neutral 
>> code still changes the way one writes code even if you don't need to 
>> handle errors explicitly (fortunately scope statements help with that).
> 
> I agree that scope statements are only necessary if you need to recover 
> from errors. I don't know what you mean by how it changes the way one 
> writes code.

I mean even if ostensibly you don't want to handle errors, you still 
need to mind the multiple hidden exit paths in your code to achieve even 
the most intuitive guarantees (such as temporarily changing a global for 
the duration of a function). Such a style of coding blindsides old-style 
SESE programmers (and is the main reason for which I unrecommend SESE).

Andrei



More information about the Digitalmars-d mailing list