develooper Front page | perl.perl5.porters | Postings from July 2009

Re: Hooks at the end of a scope during compile time

Thread Previous | Thread Next
Ben Morrow
July 15, 2009 14:38
Re: Hooks at the end of a scope during compile time
Message ID:
Quoth (Florian Ragwitz):
> The following patch implements a new special variable,
> @{^COMPILE_SCOPE_CONTAINER}, which allows implementing the behaviour required
> by the current users of the %^H + Scope::Guard and B::Hooks::EndOfScope users.

Oh, snap! I'm just in the middle of writing a more general solution to
the same problem, which I've currently got at . My idea was not to use a
special variable, but rather a new special block, SCOPECHECK, which gets
called at the end of compiling the current scope. My intention was to
implement ENTER/LEAVE/&c. from Perl 6 at the same time.

Module like B::H::EOS would need a way to install these SCOPECHECK
blocks into the calling scope, of course, so I've also written a
Block::Util module that knows how to do that. My proposal was going to
be that this be dual-life, and hold the best-effort hacks (like the %^H
hack) for implementing these semantics on older perls. That way they're
under the pumpking's eye, and if something in maint breaks them we get
notice and can fix it.

It's a shame I missed your comment on #p5p: I'm afraid I don't really do


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About