On 10 Dec 2002 11:41:23 +0000, Simon Cozens wrote:
> [EMAIL PROTECTED] (Damian Conway) writes:
> > I don't think the method-call syntax allows it. I think methods
> > need their parens. So we need:
> > 
> >     (@foo, @bar) := @a
> >         . grep( { $_ > 0} )
> >         . sort( { $^b <=> $^b } )
> >         . part( [/foo/, /bar/] );
> 
> *Why* do methods need their parens? If methods can be specified to possibly
> take a block, such as grep and sort do, then they shouldn't need parens.
> Or at least, I know a language in which this is possible... :)

To know whether the method takes a block, you need to know how it's been
declared. In other words, the type of @a needs to be known to find grep's
declaration. In turn, grep must specify its return type in order to find
sort's declaration, and sort must specify its return type so that part's
declaration may be found.

That's all fine for the standard/builtin methods on arrays, but its a bit
unperl-like to force users to highly specify everything. Of course, if they
do declare methods with all the bells and whistles, they get the benefit of
not having to use parens later on.

-- 
        Peter Haworth   [EMAIL PROTECTED]
"Although they all look the same to me, doormats and other furnishings
 probably have a strict social heirarchy. Every chair a god. Every item
 of pottery from the Franklin mint, an angel. Man, I love decor."
                -- Ashley Pomeroy

Reply via email to