On Tue, Sep 28, 2010 at 04:20:31AM +0200, Florian Ragwitz wrote: > I believe the functionality provided by Devel::GlobalDestruction's > in_global_destruction() should be in the core. +1 > I thought about how to expose that, and liked the idea of passing an > "are we in global destruction?" flag as an extra argument to DESTROY > best. However, it might break code calling DESTROY explicitly with extra > arguments as well as code asserting for only one argument in DESTROY, > like pretty much every DESTROY XSUB in existence. > > The first breakage was beyond anything I would care about, but having to > update almost all destructors in all XS modules out there seemed like > something we don't want to do. > > So I implemented a global variable called ${^GLOBAL_DESTRUCTION} > instead. In addition to what the extra destructor argument would've > allowed, this also allows checking for global destruction at any point, > not just directly in destructors. That might be a benefit, but I > honestly don't care about it all that much - things like Scope::Guard > could as well just pass down the destruction flag if they want to > support callees that care about it. Nice and clean design. I like it.Thread Previous | Thread Next