| | 622 | {-| |
| | 623 | A sub that has a non-empty 'SlurpLimit' is a bound (or partially bound) sub |
| | 624 | that has a finite number of slurpy scalar params bound, and no slurpy array |
| | 625 | param bound (see 'VCode' and "Pugs.Bind"). |
| | 626 | |
| | 627 | Each list entry consists of the number of slurpable args expected, and an |
| | 628 | expression that will evaluate to the actual list of slurpable args. |
| | 629 | When the sub is called (see 'Pugs.Eval.apply'), the expression is evaluated. |
| | 630 | If it evaluates to /too many/ args, the call will fail. |
| | 631 | |
| | 632 | This needs to be a list (rather than a @Maybe@) because Perl6's @.assuming@ |
| | 633 | (i.e. explicit currying) means that a sub can have its arguments bound in |
| | 634 | separate stages, and each of the bindings needs to be checked. |
| | 635 | |
| | 636 | >[12:02] <autrijus> scook0: .assuming will impose multiple limits |
| | 637 | >[12:02] <autrijus> because you can assume (curry) multiple times |
| | 638 | >[12:02] <scook0> ah |
| | 639 | >[12:02] <scook0> I'll have to write that in the docs then |
| | 640 | >[12:03] <scook0> Am I correct in that they only apply to subs that take a finite number of slurpy scalars? |
| | 641 | >[12:04] <scook0> Slurpy array params seem to nuke the SlurpLimit |
| | 642 | >[12:04] <scook0> because slurpy arrays can take any number of args |
| | 643 | >[12:07] <autrijus> scook0: yes, and yes. |
| | 644 | -} |
| | 905 | |
| | 906 | >[11:56] <autrijus> scook0: I'm been thinking to split a Pad entry into single and multiple variants |
| | 907 | >[11:57] <autrijus> MkPad !(Map Var ([(TVar Bool, TVar VRef)])) |
| | 908 | >[11:57] <autrijus> becomes |
| | 909 | >[11:58] <autrijus> data Pad = MkPad !(Map Var PadEntry) |
| | 910 | >[11:58] <autrijus> data PadEntry = MkEntry (TVar Bool, TVar VRef) | MkEntryMulti [(TVar Bool, TVar VRef)] |
| | 911 | >[11:58] <autrijus> yeah. but it's not critical, so is low priority |