To be clear about this, I don't really want to see Variable::Magic in the core. It's just easier to adapt it to possible future core changes than to constrain the core to it. > 1: The proposal is to bring in all of Variable::Magic, in order to use one > interface it provides. However, this inherently offers all of its interface > as part of the core distribution, which means that all of that interface > needs to remain. We can't hide the parts of the interface it does not need. > There isn't much difference between exposing the part that autodie would need and the whole magic interface. It's kind of all or nothing. > 2: Modules in core control both ends of the XS interface. > Modules on CPAN can't. > Whilst the end result of a module on CPAN might be exactly what is desired > here, it's implementation may not. On CPAN, it's inherently constrained to > use the interface the core already exposes. It might be using it in > undocumented ways. So we might be > a: about to add something that is actually fragile in its implementation > b: about to "bless" that way of doing things, based on the copy-paste > "do as I do" model of how a lot of CPAN code actually ends up being > written This I agree with. A better specific interface could be designed for the core, but it's not reasonable to target it for maint. It makes a good todo item for 5.12 though, as well as being able to store anything in the hints hash (and retrieve it at run time) in a thread safe way. > > * The Variable::Magic part of B::Hooks::EndOfScope can be replaced by > > tieing %^H to add it a destructor. The only drawback that I know of is > > that dieing at compile-time in the scope of the pragma can then generate > > some spurious "(in cleanup)" messages. > > If it's convenient, could you provide an example? I'm happy with the idea > that %^H can be tied. I presume it could then trigger a destructor at the > end of lexical scope. I guess that means that string eval actually copies > %^H into an entirely new structure, rather than increasing the > ref-count of > the old one? The attached file is a drop-in replacement for B::Hooks::EndOfScope that uses tie. Vincent.Thread Previous | Thread Next