Re: $!
[email protected] (Peter Scott) Thu, 17 Aug 2000 14:45:37 -0700
| Newsgroups | perl.perl6.language.errors |
|---|---|
| Message-ID | <[email protected]> |
At 12:51 PM 8/17/00 -0700, Damien Neil wrote: >Hmm. It just occurred to me that you could combine your idea with >exceptions quite nicely: All core functions throw exceptions on >error, but only when called in a void context. (As well as, perhaps, >when a given pragma is in effect.) This way, old code which correctly >checks errors will run without modification. Old code which >incorrectly ignores errors will get error checking. (And old code >which correctly ignores errors breaks, which is probably enough of >a problem to torpedo the whole idea. Alas.) > > open(FD, "foo") or die; # Scalar context, no exception thrown. > open(FD, "foo"); # Void context, exception thrown on error. This is the territory of RFC 70, which wants to expand the scope of Fatal.pm, and RFC 80, which wants a rich object-oriented structure for the exceptions. But I was just asking something far more mundane, predicated on $! surviving in much the same form: can its scope be expanded to be more than just the current set of system calls? -- Peter Scott Pacific Systems Design Technologies