.clone does not respect listyness of attribute
Opened this issue · 0 comments
samuraisam commented
Gist:
$object.clone()
does not respect the listyness of attributes. When calling .clone(list_attr=>[$value])
the resulting list_attr
is a list containing a list. When calling .clone(:list_attr($value))
the resulting list_attr
is a list, as desired.
Gist, for reals: https://gist.github.com/samuraisam/5819387/44d63480908601244ea8bb09e28e0ecd32d117db
Relevant IRC Log
[18:08:03] <ssutch> so, .clone works if i use the :arg(a,b,c) syntax
[18:08:11] <ssutch> but not if use arg=>[a,b,c]
[18:08:15] <timotimo> r: class Bob { has @.foo; }; Bob.new(:foo([1, 2, 3])).clone(:foo([1, 2, 3])).perl.say;
[18:08:16] <+camelia> rakudo b2072f: OUTPUT«Bob.new(foo => Array.new([1, 2, 3]))»
[18:08:23] <timotimo> oh, look!
[18:08:28] <ssutch> yep
[18:08:32] <timotimo> r: class Bob { has @.foo; }; Bob.new(:foo([1, 2, 3])).clone(:foo(1, 2, 3)).perl.say;
[18:08:32] <+camelia> rakudo b2072f: OUTPUT«Bob.new(foo => Array.new(1, 2, 3))»
[18:08:48] <timotimo> clone doesn't seem to know about the listyness of @.options
[18:09:48] <timotimo> there's no test in the test suite that would cover it and there's no mention of how it should behave in the specs
[18:10:08] <timotimo> so ... specbug?