Apocalypse 4 Online

pudge on 2002-01-18T03:23:40

Larry Wall's Apocalypse 4, the fourth installment of his series describing Perl 6, is online now at ww.perl.com. This one is all about blocks and statements and declarations and scopes, which is my kind of revelation.


A question

eann on 2002-01-20T22:44:42

About 3/4 of the way down page 5, Larry answers the RFC's request for a subroutine to execute on_catch_enter or on_catch_exit with a suggestion to use temp "provided the implementation is smart enough to look for those hooks".

Maybe I didn't understand the original question--I do admit to not reading the RFC--or Larry's explanation of how stuff fits together. Since CATCH is a closure, why can't it just have its own PRE and POST blocks? Something like:


try {
    # ...
    CATCH {
        PRE        { on_catch_enter(); }
        POST       { on_catch_exit(); }
        when /foo/ { handle_foo(); }
        when /bar/ { handle_bar(); }
        default    { die; }
    }
}


P.S. to Pudge: That's a pretty weak set of allowed tags for discussing programming. <code> and <pre> are most notably absent.

Re:A question

pudge on 2002-01-21T13:33:40

They are not allowed for good reason. PRE is not allowed because it allows people to totally break the formatting of a page. CODE is not allowed because it doesn't do what you want anyway; most notably, it won't preserve whitespace (might as well just use TT). There is a hack in the code that allows you to use LITERAL, which is kinda like CODE, but it is not well-tested and needs to be better integrated into the code at some point.

Re:A question

TimToady on 2002-01-22T20:13:09

PRE and POST would only fire off on that particular CATCH. The hooks in question would fire off on any CATCH within the dynamic scope.

Larry