ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: sub my_zip (...?) {}
by Larry Wall other posts by this author
Jun 16 2005 2:16PM messages near this date
Re: sub my_zip (...?) {} | Re: sub my_zip (...?) {}
On Thu, Jun 16, 2005 at 01:05:22PM -0700, Dave Whipp wrote:
: Larry Wall wrote:
: >  You must
: > specify @foo[[;]@bar] or @foo[()] <== @bar to get the special mark.
: 
: I'm uncomfortable with the  specific syntax of @a[()] because generated 
: code might sometimes want to generate an empty list, and special-casing 
: that sort of thing is always a pain (and fragile). An empty list of 
: subscripts should return an empty slice.

If you don't actually pipe to it, a null list is exactly what it would be
interpreted as, so I don't think it's a very big problem.  And outside
of generated code, () is always intentional.  If there's a potential
problem, it's with expecting

    @a ==> 
	foo().bar()

to feed bar() rather than foo().  So maybe that would have to be written

    @a ==> 
	foo().bar(())

or

    @a ==> 
	foo(()).bar()

Or maybe as you say we just need a special term, though I don't think ...
is it.

: What this mark is really trying to say is "The definition of the indices 
: is coming from elsewhere". I'm wondering if these semtantics would make 
: it appropriate to use the yada operator here:
: 
:    @foo[...] <== @bar;

That's cute, but I think that might be overloading the ... token a
bit too much, and it's also rather likely to be confused with the
postfix ... operator within subscripts.  These would be too close,
visually speaking:

    @foo[...]
    @foo[0...]

I suppose a case could be made for

    @foo[@=]

or some such, since it's an inside out iterator.  But () is prettier.
Alternately we could go with the unix pipe character:

    @foo[|]

Or maybe a splat

    @foo[*]

Or go with the parens with something in them to indicate the positive
absence of something.

    @foo[(*)]

Anyone else want to have a go at this bikeshed?

Larry
Thread:
Autrijus Tang
Larry Wall
Smylers
Gaal Yahas
Larry Wall
Dave Whipp
Larry Wall
Luke Palmer
Larry Wall

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved