Lucifers,

I created a branch that simplifies the way we enable operator overloading for Perl objects. Overloading is now activated for all objects because it's a much cheaper operation than the original code assumed. It's actually a no-op with recent Perls.

    https://github.com/nwellnhof/lucy-clownfish/commits/enable_overload

The code in S_lazy_init_host_obj essentially duplicates sv_bless, so we have to keep track of the changes throughout Perl's history.

In Perl 5.10, the AMAGIC flag was moved from the (outer) reference to the (inner) object:


http://perl5.git.perl.org/perl.git/commitdiff/dd2eae666980a8d8bd145f2f6cc632a45513f9ce

This means that the call to SvAMAGIC_on is only needed when creating the inner object. My branch doesn't make use of this optimization.

The handling of the the AMAGIC flag changed again in Perl 5.18. This commit moves the AMAGIC flag from the (inner) object to the stash:


http://perl5.git.perl.org/perl.git/commitdiff/a1cd65be3e8d2e7a6b4edef2ff5eee74e79cf497

According to the following commit, it isn't necessary to handle the AMAGIC flag during object creation:


http://perl5.git.perl.org/perl.git/commitdiff/bee7c5743fabd49c584c5edbb637c66c5c25ca9a

All of this could be simplified by replacing S_lazy_init_host_obj with sv_bless. It seems that Clownfish had to create the inner Perl objects without the outer reference at some point, but this doesn't seem to be necessary anymore.

Nick

Reply via email to