develooper Front page | perl.perl6.language | Postings from April 2005

Formal Parameters To While Block

Thread Previous | Thread Next
Joshua Gatcomb
April 26, 2005 08:24
Formal Parameters To While Block
Message ID:
<as it appears the email I sent before subscribing is being held and I
am impatient, I have subsequently subscribed and am resending from a
different address>

Please forgive me, but I have only recently started
following the language side of p6 after spending a
fair amount of time with Parrot.  Last night I
installed Pugs and wrote my first p6 code:

Reading S04, it seems that there are no implicit
blocks around control structures, so p5 code like:

while ( my @array = $ref->() ) { ... }

would scope my @array appropriately, it will not in p6

The solution is formal parameters.  The trouble is I
can't seem to find a good example in S04 that matches
what I am trying to do.

while $ref() -> @array { ... }

is what I think it might be modeling it after the for
loop, but the closest thing I see in while is:

while =$*IN -> $line {...}

I am happy to write tests to get the appropriate
functionality in Pugs, but I am not sure what is

Joshua Gatcomb
a.k.a. L~R

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About