Changeset 3144

Show
Ignore:
Timestamp:
05/13/05 09:56:40 (4 years ago)
Author:
scook0
svk:copy_cache_prev:
4718
Message:

Updated Haddocks to reflect Autrijus's answers to my questions

Location:
src/Pugs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/AST/Internals.hs

    r3120 r3144  
    620620-- expressions ('Exp'). 
    621621type Bindings   = [(Param, Exp)] 
     622{-| 
     623A sub that has a non-empty 'SlurpLimit' is a bound (or partially bound) sub 
     624that has a finite number of slurpy scalar params bound, and no slurpy array 
     625param bound (see 'VCode' and "Pugs.Bind"). 
     626 
     627Each list entry consists of the number of slurpable args expected, and an 
     628expression that will evaluate to the actual list of slurpable args. 
     629When the sub is called (see 'Pugs.Eval.apply'), the expression is evaluated. 
     630If it evaluates to /too many/ args, the call will fail. 
     631 
     632This 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 
     634separate 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-} 
    622645type SlurpLimit = [(VInt, Exp)] 
    623646 
     
    869892This is to allow for multi subs, because we will need to keep 
    870893/multiple/ subs associated with one symbol. In other cases, the list 
    871 should just contain a single value. See 'genSym' and 'genMultiSym' for 
     894should just contain a single value. See 'Pugs.AST.genSym' and 'Pugs.AST.genMultiSym' for 
    872895more details. 
    873896 
     
    880903The current global and lexical pads are stored in the current 'Env', which 
    881904is 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 
    882912-} 
    883913data Pad = MkPad !(Map Var ([(TVar Bool, TVar VRef)])) 
  • src/Pugs/Bind.hs

    r2978 r3144  
    4949are given, only the first gets the arguments--the rest get an empty hash. 
    5050Used 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 
    5157-} 
    5258bindHash :: [Exp]   -- ^ Named arguments (pair expressions) that were not 
  • src/Pugs/Monads.hs

    r3142 r3144  
    33{-| 
    44    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". 
    58 
    69>   One Ring to rule them all,