Changeset 3144
- Timestamp:
- 05/13/05 09:56:40 (4 years ago)
- svk:copy_cache_prev:
- 4718
- Location:
- src/Pugs
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/AST/Internals.hs
r3120 r3144 620 620 -- expressions ('Exp'). 621 621 type Bindings = [(Param, Exp)] 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 -} 622 645 type SlurpLimit = [(VInt, Exp)] 623 646 … … 869 892 This is to allow for multi subs, because we will need to keep 870 893 /multiple/ subs associated with one symbol. In other cases, the list 871 should just contain a single value. See ' genSym' and 'genMultiSym' for894 should just contain a single value. See 'Pugs.AST.genSym' and 'Pugs.AST.genMultiSym' for 872 895 more details. 873 896 … … 880 903 The current global and lexical pads are stored in the current 'Env', which 881 904 is stored in the @Reader@-monad component of the current 'Eval' monad. 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 882 912 -} 883 913 data Pad = MkPad !(Map Var ([(TVar Bool, TVar VRef)])) -
src/Pugs/Bind.hs
r2978 r3144 49 49 are given, only the first gets the arguments--the rest get an empty hash. 50 50 Used by 'bindSomeParams'. 51 52 >[12:16] <scook0> autrijus: At the moment, if you call a sub that has multiple slurpy arrays, 53 > Pugs deliberately binds the first one normally, and makes all the rest empty 54 >[12:17] <scook0> Is this proper behaviour, or is it just a quirk of the current implementation? 55 >[12:17] <autrijus> no, that's specced. 56 >[12:17] <autrijus> i.e. correct 51 57 -} 52 58 bindHash :: [Exp] -- ^ Named arguments (pair expressions) that were not -
src/Pugs/Monads.hs
r3142 r3144 3 3 {-| 4 4 Monad structures. 5 6 Note that there aren't actually any monads defined here--try looking in 7 "Pugs.AST.SIO" and "Pugs.AST.Internals". 5 8 6 9 > One Ring to rule them all,
