gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Nit


From: Andrew Suffield
Subject: Re: [Gnu-arch-users] Nit
Date: Mon, 20 Oct 2003 19:57:32 +0100
User-agent: Mutt/1.5.4i

On Mon, Oct 20, 2003 at 09:57:47AM -0700, Dustin Sallings wrote:
> 
> On Monday, Oct 20, 2003, at 03:21 US/Pacific, Robert Collins wrote:
> 
> >Oh, and as for exceptions being 'all that' ? Exceptions don't prevent
> >bad state in objects, they don't prevent bugs, all they do is ensure
> >that cleanup routines have a chance at trapping abnormal events within
> >the same process.
> 
>       I don't think this is quite accurate.  Exceptions allow you to 
> separate error handling from programming logic.  Consider the following 
> pseudo-code:
> 
>       open(file);
>       readFrom(file);
>       close(file);
>       open(file2);
>       writeTo(file2, "Did some stuff\n");
>       close(file2);
> 
>       In languages that do not raise exceptions normally upon error, you 
> have to check the results of each of those calls to make sure they're 
> successful, as well as figuring out something to do when they're not.  
> These are two things that put extra burden on a programmer that is 
> often skipped because it's additional work that is not directly related 
> to the logic that the programmer wants expressed.

I have never written code like this. Anybody who does is a
moron. Morons cannot be helped except with a shotgun, and should
definitely not be allowed to write code.

>       Exceptions are more about doing the right things with less work.  
> Given two languages, one that generally throws exceptions in 
> open/read/write (python) and one that does not (perl), consider the 
> consequences.  I would have to add code to the perl version (ignore 
                                                               ^^^^^^
> Fatal for now, I think that's a fairly stupid hack) in order to remove 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

That says it all, really. It does precisely what you want with no
appreciable source code or runtime overhead, while making the other
path available to people that want it with similar lack of overhead,
and you call it a "stupid hack".

I think your value function is broken, or at least contrived.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]