Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 102630
Status: open
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: anonymous class instances contain a reference to its meta
An instance of a class created with Moose::Meta::Class->create_anon_class contains the metaclass in the '<<MOP>>' key -- is this really necessary? We stopped doing this for regular classes a while back (partially because of the huge spam created when data-dumping the object). $class->meta should be perfectly capable of finding the metaclass without us having to store a reference to it in the object instance itself.
CC: ;
Subject: Re: [rt.cpan.org #102630] anonymous class instances contain a reference to its meta
Date: Sat, 7 Mar 2015 19:02:05 -0500
To: Karen Etheridge via RT <bug-Moose [...] rt.cpan.org>
From: Jesse Luehrs <doy [...] tozt.net>
Yes, it is - anon classes are weak refs by default, so they need a way to not be deleted while instances still exist, or else things break. There are tests for this. As far as I know, we've never done this for regular classes - the only reason for this key existing is to manage weak metaclasses. It's possible you could get the same effect with some weird inside-out fieldhash trickery, but it would probably be complicated and hard to get entirely correct. -doy
RT-Send-CC: doy [...] tozt.net
Ok, fair! I'll leave this open as a wishlist item in case anyone has any clever (but not too clever) ideas.