Moose::Autobox

On Fri, Feb 08, 2008 at 19:35:36 -0500, Ricardo SIGNES wrote:
> 
> I want a ArrayRefish type that acts like Object::Array, and maybe a HashRefish
> type that acts like Object::Hash.  I want to be able to push and splice my
> arrays, this sucks:
> 
>   push @{ $object->relatives }, $value;
> 
> MXAH doesn't make it much better, in my opinion:
> 
>   $object->push_relatives, $value;
> 
> Sure, there's no ugly syntax, but now I have one method per (op x attr), and I
> probably have to set those up manually more often than I want.
> 
> I'd rather type:
> 
>   $object->relatives->push($value);
> 
> Heck, with this I can even (mostly) keep an auto_deref-like behavior by
> returning that sort of value when called in list context, since all the method
> calls will be imposing scalar context.  This will be weird:
> 
>   my $scalar = $object->relatives;
> 
> ...but I don't mind relying on social pressure and the plurality of the
> attribute name to force me to pay more attention.
> 
> Obviously, these should be able to auto-upgrade from stock $whatever 
> references
> when set.
> 
> -- 
> rjbs



-- 
  Yuval Kogman <[EMAIL PROTECTED]>
http://nothingmuch.woobling.org  0xEBD27418

Reply via email to