Re: Magic-v2, Clone, and a possible `sv_clone` API function
[email protected] ("Paul \"LeoNerd\" Evans") Fri, 5 Jun 2026 17:10:08 +0100
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 4 Jun 2026 14:53:43 +0100 "Paul \"LeoNerd\" Evans" <[email protected]> wrote: > I've been looking around CPAN for possible modules that might break > with some of the new "Magic v2" things I am lining up for next > development cycle. Originally I was looking for things that might get > upset if we start removing any of the internal v1 magic types, and I > encountered the Clone module - because it has a comment mentioning > PERL_MAGIC_arylen. While this itself is just a comment, on a further > reading of the code in that module it looks like it's actually > concerned quite closely with a lot of the details of how Magic (v1) > currently works. This code wouldn't cope well with v2 Magic > structures. > > My first thought for thinking about Magic-v2 is that a lot of the code > would need quite a bit of editing and adjusting. > > Looking around CPAN more I also see that the code has basically been > copy-pasted into at least two other dists; Clone-AsUTF8Bytes and > Class-XSConstructor. This starts to suggest that actually, rather than > living in a CPAN module, this sort of "sv_clone" API function ought to > exist at the core perl level itself. That way, it would be able to do > the right thing with a new version of Magic, or any other newer > behaviours that get added. > > (While I'm there I notice it also doesn't handle SVt_PVOBJ, the new > "object" SV type that was added in Perl 5.38 as part of the `class` > feature, so that too would want to be looked at). > > Perhaps between us we can manage to find a good solution here. Oops, I realise I emailed the wrong person here - Toby is the author of one of the modules, but Clone is currently maintained by Atoomic. So, er.. as above :) -- Paul "LeoNerd" Evans [email protected] http://www.leonerd.org.uk/ | https://metacpan.org/author/PEVANS