Excerpts from Dmitry Karasik's message of Wed Jan 13 12:27:17 -0500 2010: > > How do you know that the first is setting a single-element list and the > > second > > is setting an empty list? > > context = (( 1 == @_ and ref($_[0]) eq 'ARRAY') ? 'array' : 'list')
That doesn't actually answer the question. Suppose you have a list of arrayrefs: $obj->prop([ 1, 'one' ], [ 2, 'two' ], [ 3, 'three', 'drei' ]); You need to mutate this list for some reason, @list = $obj->prop; @list = grep { @$_ > 2 } @list; and save it back in the object. $obj->prop(@list); Oops, this turns out to be $obj->prop([ 3, 'three', 'drei' ]) so your heuristic guesses that it's meant to dereference the array, which is wrong. There is no way to get this right with the interface you are suggesting. > > This doesn't seem like good design to me; there's a reason that auto_deref > > is > > deprecated. > > Thank you for sharing your thoughts on the design; I however would rather much > more appreciate help with the implementation instead. Read Moose::Meta::Attribute and Class::MOP::Attribute and all the method metaclasses they use. You are shooting yourself in the foot; I don't feel like spending the time to walk you through pulling the trigger. Also, please reply on-list to list messages unless you're going on a tangent. hdp.