-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 1/4/10 10:38 PM, Karen Etheridge wrote: > What would it take to gain the properties of MooseX::Role::Strict in > MooseX::Role::Parameterized? I've been using strict roles everywhere and > love them -- they've caught a few bugs that I'm sure would have been > dreadful to track down otherwise; now I'm parameterizing a few of my roles > and I'm mourning the loss of strict checking.
MooseX::Role::Parameterized is designed to be as extensible as Moose, so I would hope that it can support this. When you say "package Foo; use MooseX::Role::Parameterized;" it creates a role metaobject for Foo, the class of which is MooseX::Role::Parameterized::Meta::Role::Parameterizable (quite a mouthful). In MXRPMRP there is a constant: use constant parameterized_role_metaclass => 'MooseX::Role::Parameterized::Meta::Role::Parameterized'; This constant decides the class of the role metaobject created when you apply the parameterized role. So, to get what you want, I think you need to: 1. define a class (for now let's call it Role::Strict::Parameterized) 1a. subclass MooseX::Role::Parameterized::Meta::Role::Parameterized 1b. also subclass MooseX::Meta::Role::Strict 2. subclass MooseX::Role::Parameterized::Meta::Role::Parameterizable 2a. use constant parameterized_role_metaclass => 'Role::Strict::Parameterized'; You'll have multiple inheritance, which obviously sucks. I'm sorry for my half of that. It will be straightforward for me to refactor the guts of MooseX::Role::Parameterized::Meta::Role::Parameterizable (which is just two attributes) into a role. I'll do that at some point this week. Hopefully that makes some amount of sense. You have a lot of metaprogramming ahead of you. Good luck and feel free to ask plenty more questions. Shawn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAktDhgUACgkQsxfQtHhyRPosIwCdER+flH5ar2QKXAYM9N9q9lZC E2oAn3Q/KWHR3xJX9zSQqGStghhLBFHT =CN+X -----END PGP SIGNATURE-----