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
Download (untitled) / with headers
text/plain 421b
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>
Download (untitled) / with headers
text/plain 465b
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
Download (untitled) / with headers
text/plain 108b
Ok, fair! I'll leave this open as a wishlist item in case anyone has any clever (but not too clever) ideas.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.