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

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

Thread Previous | Thread Next
From:
Larry Wall
Date:
June 17, 2005 11:20
Subject:
Re: sub my_zip (...?) {}
Message ID:
20050617182010.GB817@wall.org
On Thu, Jun 16, 2005 at 10:28:26PM +0000, Luke Palmer wrote:
: You know, before I read this part of the message, I was thinking
: precisely that.  Nullary splat should do it, so that @foo[*] will
: work.  Unary splat would of course get our favor if it can be
: interpreted that way, but in cases like:
: 
:     @foo[*]
:     bar(*)
: 
: It is unambiguous, and you can always say (*) to disambiguate.  I like
: the look of that too.

Except I've still got my eye on nullary * to mean "all keys in this
dimension", and that would conflict if you want that meaning for part
of an expression but pipe to a different part.

One character that *would* work in that position is the Unix "pipe"
character: |.

    @foo[|]
    bar(|)

On the other hand, that kind of points out the fact that we *aren't*
using | for pipes in Perl 6.  It'd be nice to have some kind of visual
reference to <== and ==>.  Perhaps

    @foo[<>]
    bar(<>)

could be forced into that duty, on the assumption that if you really
want a null string, there's always some kind of '' workaround.
But that's concentrating on the pointy parts of the pipe operators.
How 'bout focusing on the pipey parts instead and use a nullary
iterator:

    @foo[=]
    bar(=)

I kind of like that, particularly since the pointy end of a pipe *is*
an iterator.

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About