Hi,
OK, good news and bad. :-) Cutting down the example a tad for the
interesting bit:
> sub array_slurpy (*...@array) {
> say sprintf "Array has %d elements and the first value is
> '%s'",
> @array.elems, @array[0];
> return @array;
> }
>
> sub array_slurpy_copy (*...@array is copy) {
> say sprintf "Array has %d elements and the first value is
> '%s'",
> @array.elems, @array[0];
> return @array;
> }
>
> my @array = <a b c>;
>
> my @new_array = array_slurpy(@array);
> say @new_array[0];
>
> @new_array = array_slurpy_copy(@array);
> say @new_array[0];
>
> This outputs the following:
>
> Array has 3 elements and the first value is 'a'
> a
> Array has 3 elements and the first value is 'a'
> a b c
>
> So the "*...@array is copy" behaves like the rest when in the sub, but
> when returned, returns a single item.
>
OK, so now they give the same result, thanks to fixing a bug in 'is
copy' when handling arrays. Which is:
Array has 3 elements and the first value is 'a'
a
However, I fear we may now have a bug in slurpy. Because if you pass an
array and you have a slurpy parameter, you should get an array of
arrays, the first element of the array of slurped parameters being the
array. And when it returns, I would expect that the you'd get the array
of arrays returned. So in fact I think the correct output for both of
these two with the slurpy maybe should be:
Array has 1 elements and the first value is 'a b c'
a b c
Thoughts?
Thanks,
Jonathan