File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -675,6 +675,35 @@ The nice thing about the distinction here is that it gives the developer the
675
675
option of passing pairs as either named or positional arguments, which can be
676
676
handy in various instances.
677
677
678
+ = head2 Argument Count Limit
679
+
680
+ While it is typically unnoticeable, there is a backend-dependent
681
+ argument count limit. Any code that does flattening of arbitrarily
682
+ sized arrays into arguments won't work if there are too many elements.
683
+
684
+ = for code
685
+ my @a = 1 xx 9999;
686
+ my @b;
687
+ @b.push: |@a;
688
+ say @b.elems # OUTPUT: «9999»
689
+
690
+ = for code
691
+ my @a = 1 xx 999999;
692
+ my @b;
693
+ @b.push: |@a; # OUTPUT: «Too many arguments in flattening array. in block <unit> at <tmp> line 1»
694
+
695
+
696
+ Avoid this trap by rewriting the code so that there is no
697
+ flattening. In the example above, you can replace C < push > with
698
+ C < append > . This way, no flattening is required because the array can
699
+ be passed as is.
700
+
701
+ = for code
702
+ my @a = 1 xx 999999;
703
+ my @b;
704
+ @b.append: @a;
705
+ say @b.elems # OUTPUT: «999999»
706
+
678
707
= head1 Input and Output
679
708
680
709
= head2 Closing Open File Handles and Pipes
You can’t perform that action at this time.
0 commit comments