Damian Conway <[EMAIL PROTECTED]> writes:

>       sub {
>               ...
>               return $yadda_yadda;
>       }
>       always { close F }

Let's try not to fall into the Java trap.
If exception handling gets too wordy, programmers will try to reduce
the overhead by combining many statements. In Java, one often sees
things like:

    try {
        ... enormous amount of statements ...
    }
    catch ( Exception e ) {
        e.printStackTrace();
    }

As a result, error messages become utterly useless. I almost never see
a Java program that reports "Cannot open file foo". Instead, it
reports a java.lang.ioerrorexception and a stracktrace of several
pages. Useless if you do not have the source, often even if you have.

And no, don't call this just a programmer's habit. It is significantly
induced by the formality and verbosity of the language. Compare:

    open my $f, $thefile or die ("$thefile: $!\n");

with

    try {
        File f = new File (theFile);
    }
    catch ( FileNotFoundException e1 ) {
        System.err.println (theFile + ": Not found");
        System.exit();
    }
    catch ( IOErrorException e2 ) {
        System.err.println (theFile + ": IO error");
        System.exit();
    }
    catch ( ... ) {
        ...
    }

-- Johan

Reply via email to