At 11:46 AM -0500 9/28/05, Adam D. Lopresto wrote:
The recent thread on Expectuations brought back to mind something I've been
thinking for a while.  In short, I propose that "use fatal" be on by default,


I totally, TOTALLY, agree with this.

EVERY built-in function and operator that talks to program-external resources should by default throw an exception on failure, including all system calls, file or filesystem operations, network operations, interprocess communications, signals, etc.

It is a lot easier to write safe, correctly functioning, and easy to debug programs when problems are detected as early as possible, which a default-active exception architecture ensures.

Naive developers will be helped greatly when they forget to account for possible problems, since errors don't crop up in a different place than their cause (eg, at 'print' time when the problem was with the 'open'); if they forget something, Perl will tell them.

Saavy developers who don't like the exceptions can explicitly turn them off, the very act of which implies that they know what they're doing and can handle the situations where Perl doesn't help them remember.

Considering that its a well known best practice to throw exceptions in one's own non-trivial programs and modules, it would be nice if the core language functions themselves were consistent with that practice.

Just as I agree that having 'use strict' turned on all the time and/or being the default, likewise having 'use fatal' turned on all the time and/or by default is also the best course of action. While we're at it, 'use warnings' should probably be on by default too, but this is less important than 'fatal'.

-- Darren Duncan

Reply via email to