At 10:37 PM 8/24/00 +0200, Bart Lateur wrote:
>On 24 Aug 2000 16:03:56 -0000, Perl6 RFC Librarian wrote:
>
> >Merge C<$!>, C<$^E>, and C<$@>
>
>Merging $! and $^E makes perfect sense to me. I don't know why there are
>two different error variables.

$! eq "No such file or directory";  $^E eq "CD-ROM drive door open" :-)

>  Er... wasn't that three? I'm not
>absolutely certain, but I thought there was a third one, too. <time
>passes...> Oh yes: $? AKA $CHILD_ERROR. Throw that in as well.

Actually I intentionally left it out.  But I am starting to think you're right.

>But $@ is an entirley different beast.
>
>         eval {
>                 open ",^#!" or die "Cannot open file: $!"
>         };
>         print $@;
>
>$@ contains the whole user provided string, possibly including script
>file name, line number and input record number. But $! is just the "file
>does not exist" string. Two different things.

The proposal is that $! would be overwritten with the die string.  Reason: 
whoever's interested in both $@ and $! at the end of an eval?  There was an 
error; everyone looks at $@, which almost certainly contains $! if it was 
useful.  So the above becomes:

         eval {
                 open ",^#!" or die "Cannot open file: $!"
         };
         print $!;  # Contains the user provided string etc

Yes, this is losing information; the former $! is no longer around.  I 
contend that it's eliding functionality that is seldom, if ever, used, in 
favor of a natural simplification.  There's one place where an error 
message shows up.  One.  No need to figure out what kind of thing failed.
--
Peter Scott
Pacific Systems Design Technologies

Reply via email to