Raku / roast

🦋 Raku test suite
https://raku.org/
Artistic License 2.0
181 stars 135 forks source link

Relevance of some shaped Array tests #482

Open SyrupThinker opened 6 years ago

SyrupThinker commented 6 years ago

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?

zoffixznet commented 6 years ago

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.

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])␤» 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])␤»