Show
Ignore:
Timestamp:
04/15/06 15:03:07 (3 years ago)
Author:
audreyt
Message:

* Capture.pod: de-handwave the \\\ref question

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/FAQ/Capture.pod

    r9955 r9957  
    160160  @y[][][]; 
    161161 
    162  
    163162= Q: Does this mean I can't have something akin to a refrence to a reference? 
    164163 
    165 [ hw !! 1 ] 
    166 You can, because a Signature can contain Captures. 
    167  
    168   sub apply (Code $f, Capture $args) { $f(*$args) } 
    169  
     164You can, as a Capture can contain another capture object in its invocant slot: 
     165 
     166    my $x = \\3; 
     167    say $$$x; # same as "say 3" 
     168 
     169= Q: Can I create a "pass-through" function that captures all arguments? 
     170 
     171Yes, using the \$ signature: 
     172 
     173    sub f (\$args) { g(*$args) } 
     174    f(1, 2, x => 42);   # same as g(1, 2, x => 42) 
     175 
     176The $args above becomes a Capture object. 
    170177 
    171178= Q: How is @x = (1, 2, 3) different from @y := (1, 2, 3) ?