# New Ticket Created by # Please include the string: [perl #123757] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=123757 >
Relevant snippets starting at http://irclog.perlgeek.de/perl6/2015-02-08#i_10078888 : Irrelevant distractions filtered out where indicated by ... 05:59:49 raydiak | m: class Foo { has @.bar }; Foo.new: :bar(1,2,3); Foo.new(bar => (1,2,3)); Foo.new: bar => [1,2,3]; # <-- fil__ 05:59:50 +camelia | rakudo-moar d26211: ( no output ) 06:00:31 fil__ | ok 06:00:37 fil__ | guess they all work! 06:00:51 fil__ | what's preferred? () or []? 06:01:42 raydiak | () makes a parcel which gets flattened into @.bar ... [] makes an array which does the same...preference really ... 06:03:52 raydiak | hm 06:04:34 raydiak | m: class Foo { has @.bar }; say Foo.new(:bar(1,2,3)).bar.WHAT; say Foo.new(bar => [1,2,3]).bar.WHAT; 06:04:36 +camelia | rakudo-moar d26211: OUTPUT«(Array)(Array)» 06:05:10 raydiak | m: class Foo { has @.bar }; say Foo.new( bar => (1,2,3) ).bar.WHAT; 06:05:11 +camelia | rakudo-moar d26211: OUTPUT«(Array)» 06:05:17 raydiak | m: class Foo { has @.bar }; say Foo.new( bar => Parcel.new(1,2,3) ).bar.WHAT; 06:05:18 +camelia | rakudo-moar d26211: OUTPUT«(Array)» 06:05:25 raydiak | yep, no difference in the end ... 06:09:06 raydiak | m: class Foo { has @.bar }; say Foo.new( bar => Blob[uint8].new(1,2,3) ).bar.WHAT; 06:09:07 +camelia | rakudo-moar d26211: OUTPUT«(Array)» 06:10:58 raydiak | so the type of the positional thing you pass into an @ attribute at initialization doesn't matter? iow always list assignment, not binding? 06:11:09 TimToady | hmm 06:11:42 TimToady | m: class Foo { has @.bar }; say Foo.new( bar => [1,2,3] ).bar.elems 06:11:43 +camelia | rakudo-moar d26211: OUTPUT«3» 06:12:20 TimToady | but apparently loses the itemization somewhere 06:12:47 TimToady | you'd only get 1 elem if you assigned [1,2,3] directly to @foo 06:12:51 raydiak | I thought I should be wrong about that after I explained it, but...it seems to always gives a flattened Array, regardless of what you pass in or whether it's itemized or not 06:13:06 TimToady | yeah, something a little odd going on there 06:13:26 TimToady | probably calling .list on the initializer 06:14:17 * | raydiak will rakudobug after impending dinner