Re: Treating filehandles like strings

[email protected] (Jonathan Scott Duff) Tue, 8 Aug 2000 17:15:36 -0500
Newsgroups perl.perl6.language.io
Message-ID <[email protected]>
On Tue, Aug 08, 2000 at 11:44:10PM +0200, Bart Lateur wrote:
> On Tue, 8 Aug 2000 16:32:26 -0500, Jonathan Scott Duff wrote:
> 
> >I sincerely hope you really mean "Let's make ``open() or die''
> >optional"  Exceptions should be integrated into the language but Ye
> >Olde "returns undef on error" should still be available as well.
> >
> >
> >	try { $fh = open("foo") } catch { die "Oops" }	# pick your syntax
> >	$fh = open("foo") or die "Oops";
> 
> You may hope all you want. But what I gathered, and what I liked a lot,
> was the idea that:
> 
> 	use Fatal;
> 	$fh = open("foo.txt");
> 
> would act pretty much as if you had written:
> 
> 	$fh = open("foo.txt") or die "Can't open file \"foo.txt\": $!";

Oh, that's fine too.  I don't have to "use Fatal" (or however it's
spelt in its final form) if I don't want to.  The "exception paradigm"
is often complicated for simple things.  The "returns undef on error"
paradigm is often too simple for complex error conditions.  I think we
should have both.  Let the programmer choose.

-Scott
-- 
Jonathan Scott Duff
[email protected]