Closed tobyink closed 11 years ago
@doy what are you proposing? I think this works as a starting point and a more granular approach then just overriding attribute_class
in your metaclass.
I don't really have a good answer, I'm just wondering if we want to expose it as part of the public sugar API yet, before we've had time to figure out what the actual right answer is (to avoid having to break backwards compatibility in the future once we figure it out). I might just be worrying too much though, shrug.
@doy still very much a prototype, so I think it is safe. I also don't think we need to not support this, even if it is not ideal.
Also, FYI I'm trying to get a compose
utility method working, so you can write:
has $foo ( metaclass => mopx::compose("mop::attribute", @traits) );
That covers the "what if you need more than one" case, albeit in a not especially pretty way.
Do we really want to do this? This is how attribute extensions started in Moose, until we realized how hard it was to make them work well (what if you want to use more than one extension?), and replaced them with traits. I'm still not entirely sure that traits are the right solution either, but manually setting the metaclass like this is functionality that we know from experience to be too limited.