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
From:
Ben Morrow
Date:
July 15, 2009 14:38
Subject:
Re: Hooks at the end of a scope during compile time
Message ID:
20090715213750.GA95156@osiris.mauzo.dyndns.org
Quoth rafl@debian.org (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
http://github.com/mauzo/perl/tree/blocks . 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
IRC.

Ben


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About