Changeset 14483 for src/Pugs/Eval.hs

Show
Ignore:
Timestamp:
10/24/06 17:18:18 (2 years ago)
Author:
audreyt
Message:

* Interpolation of Capture objects via prefix:<|> implemented,

suggested by eviltwin_b++:

sub f ($x, $y) { ... }
my $capt = \(1,2);
f(|$capt); # now works

Previously only Array, Hash, Scalar and Pair were intepolated.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval.hs

    r14438 r14483  
    11281128    (k, v) <- pair_fetch pv 
    11291129    return [ Syn "named" [Val k, Val v] ] 
     1130interpolateVal (VV vv) | Just (CaptSub{ c_feeds = feeds } :: ValCapt) <- castVal vv = return $ 
     1131    [ Val (castV v) | v <- concatMap f_positionals feeds ] 
     1132    ++ [ Syn "named" [Val (VStr $ cast k), Val (concatNamed v)] | (k, v) <- concatMap (Map.toList . f_nameds) feeds ] 
     1133    where 
     1134    concatNamed [x] = castV x 
     1135    concatNamed xs  = VList (map castV xs) 
    11301136interpolateVal val = return [Val val] 
    11311137