On Wed, Jul 08, 2009 at 01:28:29PM -0700, Stefan O'Rear wrote: > It is very easy to implement Class::MOP::Instance's > inline_[sg]et_slot_value functions in terms of inline_slot_access, > but very hard to do the reverse; because of this, it seems to me > that Moose::Meta::Method::Accessor should always use the more > specific, easier to implement variant. Right now, the implementations > of read/write accessors and lazy attributes both use inline_slot_access > in fairly easy to eliminate ways; is this a bug?
The implementation of accessors doesn't even use the slot access at all, that's certainly safe to remove. The implementation of lazy is currently hardcoding "$access = $value", which is almost certainly a bug. Feel free to submit a patch (with tests!). > If so, should code outside subclasses of Class::MOP::Instance be using > inline_slot_access at all? I don't see a particular reason to forbid it, assuming the access actually makes sense as an lvalue... there's possibly some interesting things that could be done with tied hashref instances or something. There's most likely not a reason in Moose core currently though, since it's only using plain hashref instances. -doy