Hi Eirik,

I thought about this a bit longer. I've seen this before that typo's in the named arguments can lead to things for which you think would happen but they don't. proper testing should reveal this of course. But it would also be nice that an error would be given by perl6 and we would have known that there was a typo or in the case below a wrong argument to the push method. Something like 'named attribute x not recognized'.

Greets,
Marcel

On Sat, Jun 13, 2015 at 12:25 PM, mt1957 <mt1...@gmail.com <mailto:mt1...@gmail.com>> wrote:

    Can't push/unshift onto an array of pairs!

    Below a repl session with pushes

        my @p = a => 1, b => 2;

    a => 1 b => 2

        @p.push(x=>1);

    a => 1 b => 2


That's not pushing a pair – that's pushing nothing (no positionals) with a named argument (name x, value 1).

Pairs vs named arguments are going to be one of the confusing points about perl6, right?

> @p.push((x=>1));
"a" => 1 "b" => 2 "x" => 1


Eirik

Reply via email to