Random Perl 6 syntax rant

Jonathan Rockway jon at jrock.us
Tue Apr 1 17:03:13 BST 2008


* On Tue, Apr 01 2008, Andy Wardley wrote:
> Here's my anti-favourite new unintuitive Perl6 syntax snippet.
>
>   for =$*IN -> $guess {
>      ...
>   }
>
> According to the source[1]:
>
>   Writing =$*IN means "get me the iterator to read from $*IN", which reads a
>   line at a time
>
> Which is presumably a lot "better" than something like, say:
>
>   for <IN> -> $guess {
>      ...
>   }
>
> Or even,
>
>   for $guess in <IN> {
>      ...
>   }

How would you distinguish between "give me a lazy iterator over each line"
and "suck everything into an array, then iterate over that"?

Yes, in most cases you will want an iterator... but wouldn't it be
confusing for some things to act like iterators and others lists (in the
... -> context)?  Yes, it would be :P

Anyway, just be glad Perl6 isn't porting over CL's LOOP keyword:

  http://www.lisp.org/HyperSpec/Body/mac_loop.html

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"


More information about the london.pm mailing list