On Fri, Aug 20, 2004 at 10:07:02PM +0200, Juerd wrote:
: I'm proposing
: 
:     for zip(@foos, @bars, @xyzzies) <-> $foo, $bar, $xyzzy { ... }
:     for %quux.kv <-> $key, $value { ... }

That'd probably work on the keys only if the hash was declared to have
object keys.  At least in Perl 5, the key is always a copy.

: to mean
: 
:     for zip(@foos, @bars, @xyzzies) -> $foo is rw, $bar is rw, $xyzzy is rw { ... }
:     for %quux.kv -> $key is rw, $value is rw { ... }
: 
: Comments, anyone?

It's really sick, and cute, and I love it.  Unfortunately I'm not sure
it passes the "Are there already too many ways to declare a sub?" test...

It's vaguely possible I could be persuaded on the basis that

    for zip @a ¥ @b <-> { ($^a,$^b) = ($^b,$^a) }

could be made to work.  But I'm still dubious.  And arguably -> {...}
means the same as sub () {...}, implying there are no arguments.

Larry

Reply via email to