develooper Front page | perl.perl5.porters | Postings from June 2008

Re: design questions

Thread Previous | Thread Next
Paul Fenwick
June 3, 2008 19:57
Re: design questions
Message ID:
G'day Aristotle / p5p,

Aristotle Pagaltzis wrote:

> I agree with this, actually. Better not to improve Fatal at all;
> just leave it around as obsolete legacy for backcompat. Oh yeah,
> someone might even have code that parses Fatal’s messages, which
> would be broken by any changes. (No, it’s not a very strong
> argument. But I agree with Roland that there is little point for
> people to newly employ Fatal in the future.)

I *can* do this.  I can have complete backwards compatibility with Fatal.  I 
can have the messages look so incredibly bad that people cry and turn away 
when they're seen, and parents tell their children to eat their vegetables, 
lest they grow up to be as ugly as a Fatal error message.  I can do this, 
but do we *really* want to?

I mean really, here's my program:

	use Fatal qw(open);
	open(my $fh, '<', 'somefile.txt');

Here's the output under old Fatal:

	Can't open(GLOB(0x814eb44), <, somefile.txt): No such file or
	directory at (eval 1) line 3
         main::__ANON__('GLOB(0x814eb44)', '<', 'somefile.txt') called at line 2

Here's the result of the same program with my new Fatal, which you can grab 
from my git repository[1]:

	Can't open 'somefile.txt' for reading: No such file or directory at line 1

I know which one I'd rather see.

The only advantage I can see for keeping the old Fatal ugly is backwards 
compatibility, and I'm not sure how strong that argument is.  Most of the 
string tests people will be searching for are things like /open/ (which 
still works), /somefile\.txt/ (which still works) or /No such file/ (which 
still works).

The advantage of making Fatal nicer overall is that people *can* download 
the new module (we're dual-lifing it, right?), drop it on their systems, and 
have error messages they'd consider showing to their users, without having 
to go through and make changes to their actual codebase.  That's a big win 
if your codebase is 100,000 lines, or you need your code (which may be a 
module going to CPAN) to still work with older Perls which don't have the 
new Fatal.

Unfortunately I really don't know how much code will break if Fatal's 
messages change.  I don't know how many people will appreciate being able to 
drop-in a replacement Fatal and have their code look nice.  I'm willing to 
be swayed in either direction.

All the best,


[1] Here's my git repository, just hit the 'download' link if you want a 

Paul Fenwick <> |
Director of Training                   | Ph:  +61 3 9354 6001
Perl Training Australia                | Fax: +61 3 9354 2681

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About