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

Re: sub my_zip (...?) {}

Thread Previous
June 16, 2005 10:03
Re: sub my_zip (...?) {}
Message ID:
Larry Wall writes:

> This does imply that we can pipe into a subscript somehow.

Why?  Or rather, why is that desirable?

> If we choose something like () for our placeholder meaning "pipe into
> this location", then
>     @foo[@a; @b; @c]
> is the same as
>     @foo[()] <== @a <== @b <== @c

That placeholder just looks to me like it's asking for people to be
confused by action at a distance.  Under what circumstances does using
the latter, with n pipes, give an advantage over the former, with n
semicolons?  Especially given:

> though perhaps there's some ambiguity problems with using a single ()
> as the target of multiple ==>.  Note that every list has an implied ()
> at the end, which is the default target of pipe operators.  That says
> to me that we probably make a rule that ==> binds to the leftmost ()
> it sees (if it sees one) ... And in the absence of an explicit (), the
> rightmost implicit () is the target

That seems to be a lot of rule to remember for some relatively obscure
feature, and it's giving a non-intuitive amount of meaning to the
innocent-looking empty list ().

> I think this is closest to what people will expect.

Hmmm.  I'm not convinced that many people would expect being able to
pipe into subscripts at all.  Except that you've almost certainly
thought about this more than I have, and you are rather good at this
language design lark -- so I'm also not convinced by my own criticism of
this feature ...


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