> On 06 Apr 2016, at 22:47, Bernhard Specht (via RT)
> <[email protected]> wrote:
>
> # New Ticket Created by Bernhard Specht
> # Please include the string: [perl #127847]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127847 >
>
>
> disallow dimensions smaller or equal 0 in shapes
> <0001-disallow-dimensions-smaller-or-equal-0-in-shapes.patch>
Thank you for your suggestion.
It would make life a lot easier if you could turn this into a rakudo Pull
Request.
Having said that, I have a few remarks about your patch:
+my class X::IllegalDimensionInShape is Exception {
+ has $.dim;
+ method message() {
+ "Illegal dimension in shape: $.dim. All dimensions must be integers
bigger than 0"
+ }
+}
+
Creating a new exception class: good!
@@ -399,11 +400,12 @@ my class Rakudo::Internals {
my $key := nqp::list(meta-obj);
my $dims := nqp::list_i();
for @dims {
- if nqp::istype($_, Whatever) {
- X::NYI.new(feature => 'Jagged array shapes');
+ my $dim = $_.Int;
+ if $dim <= 0 {
+ X::IllegalDimensionInShape.new(dim => $dim).throw;
}
nqp::push($key, type-key);
- nqp::push_i($dims, $_.Int);
+ nqp::push_i($dims, $dim);
You have to seem to have lost the check on Whatever here ??
- my $succ-nchrs =
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψωבגדהוזחטיךכלםמןנסעףפץצקרשתБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯбвгдежзийклмнопрстуфхцчшщъыьэюя١٢٣٤٥٦٧٨٩१२३४५६७८९১২৩৪৫৬৭৮৯੧੨੩੪੫੬੭੮੯૧૨૩૪૫૬૭૮૯୧୨୩୪୫୬୭୮୯ⁱ⁴⁵⁶⁷⁸⁹₁₂₃₄₅₆₇₈₉ⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻ②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵▂▃▄▅▆▇█⚁⚂⚃⚄⚅❷❸❹❺❻❼❽❾❿123456789🍻🐫';
+ my $succ-nchrs =
'123456789BCDEFGHIJKLMNOPQRSTUVWXYZbcdefghijklmnopqrstuvwxyzΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβγδεζηθικλμνξοπρστυφχψωבגדהוזחטיךכלםמןנסעףפץצקרשתБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯбвгдежзийклмнопрстуфхцчшщъыьэюя١٢٣٤٥٦٧٨٩१२३४५६७८९১২৩৪৫৬৭৮৯੧੨੩੪੫੬੭੮੯૧૨૩૪૫૬૭૮૯୧୨୩୪୫୬୭୮୯ⁱ⁴⁵⁶⁷⁸⁹₁₂₃₄₅₆₇₈₉ⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻ②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀⒁⒂⒃⒄⒅⒆⒇⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵▂▃▄▅▆▇█⚁⚂⚃⚄⚅❷❸❹❺❻❼❽❾❿123456789🍻🐫';
Not sure what the difference is here. Doesn’t seem to pertain to the issue.
In any case, if anything should happen in these lines, it should be done in the
generator script.
Liz