develooper Front page | perl.perl5.porters | Postings from August 2022

CV flag for refcounted CvXSUBANY.any_sv

Thread Next
Paul "LeoNerd" Evans
August 8, 2022 17:51
CV flag for refcounted CvXSUBANY.any_sv
Message ID:
XSUBs provide an ANY union that code can store whatever it wants, to be
later accessed within the CV body. Being an ANY union, one of the
possibilities is to store an SV pointer in there. This is fairly common
(at least, in my code).

Since it stores an SV pointer, you need to arrange for it to be
SvREFCNT_dec'ed when the CV itself is destroyed (e.g. perhaps the CV is
an anonymous closure).

Perl doesn't currently provide a facility for this, meaning I end up
having to do annoying magic on the CV just to make it happen at the
right time.

I'm thinking of adding a CV flag to tell Perl to do that automatically.
When clearing an SV it can then use


Thoughts anyone?

Paul "LeoNerd" Evans      |  |

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