roast icon indicating copy to clipboard operation
roast copied to clipboard

Relevance of some shaped Array tests

Open SyrupThinker opened this issue 6 years ago • 1 comments

https://github.com/perl6/roast/blob/f11042b93790302a3c1d792168546bd66b0204bb/S02-types/array.t#L149-L159

These tests define a shape trait that does not appear in the docs and isn't implemented in rakudo. Creating an Array with a Range is doable as well.

Do these still have any relevance?

SyrupThinker avatar Oct 08 '18 18:10 SyrupThinker

These tests define a shape trait that does not appear in the docs and isn't implemented in rakudo.

IMO that can be removed.

Creating an Array with a Range is doable as well.

There are no errors as the test expects, but does it make sense to accept those values as shapes? I was expecting them to get coerced to Ints, but looks like they remain as Range objects. And you can even use a Seq with arbitrary elements as a dimension without getting any errors.

I think that should not be behaving that way and perhaps should throw, as the test expects it to.

<Zoffix_> m: my @multidim[0..3; 0..1]; dd @multidim rakudo-moar 9acbf0004: OUTPUT: «Array element = Array.new(:shape(0..3, 0..1), [Any, Any], [Any, Any], [Any, Any], [Any, Any])␤»

<Zoffix_> m: my @multidim[0, 3...27; 0..1]; dd @multidim rakudo-moar 9acbf0004: OUTPUT: «Array element = Array.new(:shape((0, 3, 6, 9, 12, 15, 18, 21, 24, 27).Seq, 0..1), [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any], [Any, Any])␤»

zoffixznet avatar Oct 08 '18 18:10 zoffixznet