Most Perl 6 will look like Perl 5

Benjamin Smith bsmith at cabbage.org.uk
Fri Jan 25 10:51:43 GMT 2008


On Fri, Jan 25, 2008 at 09:59:19AM +0000, Jonathan Stowe wrote:
> > Becomes this:
> > 
> >   my $is_ok = 1;
> >   for 0..6 -> $t {
> 
> Now I am sure someone is going to reply "but but ... ", and I can
> assure that the wrong answer will be to explain it to *me* in relation
> to some fashionable CS idea or functional programming paradigm or
> whatever.

A) The syntax for taking multiple values from the array at once doesn't
make you want to vomit:

5: for my ($t, $s) (0..6) { }
6: for 0..6 -> $t, $s { }

B) The bit between -> and { is now using the same syntax as for any
subroutine argument declaration.

sub something ($t is rw) { $t = 5 }
my $anon = -> $t is rw { $t = 5 }
for 0..6 -> $t is rw { $t = 5 }

Are these fashionable CS ideas or functional programming paradigms?
(Making things read-only by default sure does sound like functional
programming to me.)

-- 
Benjamin Smith <bsmith at cabbage.org.uk>


More information about the london.pm mailing list