Rationale for $!
[email protected] (Felipe Gasper) Wed, 27 Jan 2016 01:17:33 -0500
| Newsgroups | perl.perl6.language |
|---|---|
| Message-ID | <[email protected]> |
Hello, What is the purpose of having $! in Perl 6? The global variables in Perl 5 are a constant headache, prompting us to need to local()ize variables like $@, $!, and $? to avoid unforeseen consequences like RT #127386 and those documented in Try::Tiny’s POD. Perl 6 seems to give us both the “right” and the “wrong” solution to accessing exception variables: we get $_ within a CATCH block (right), but we also get that global $!--which, to me, seems pathologically wrong. The need to access the exception outside of a catch() block is not nonexistent, but why this $! syntactic sugar rather than just expecting people to do like: http://perl6maven.com/how-to-catch-an-exception-in-perl6 Thank you! -Felipe Gasper Houston, TX