develooper Front page | perl.perl6.language | Postings from April 2006

Re: Adverbs

Thread Previous | Thread Next
Larry Wall
April 24, 2006 21:07
Re: Adverbs
Message ID:
On Mon, Apr 24, 2006 at 08:30:04PM -0700, Jonathan Lang wrote:
: Larry Wall wrote:
: > Jonathan Lang wrote:
: > : How do you define new adverbs, and how does a subroutine go about
: > : accessing them?
: >
: > Adverbs are just optional named parameters.  Most of the magic is in
: > the call syntax.
: Ah.  So every part of a Capture Object has an alternate call syntax:
:   act $foo, @list, bar => 'baz';
: is the same as
:   @list ==> $foo.act:bar('baz');
: right?

You might have to write that

   @list ==> $foo.act :bar('baz');

I think or the colon on the method would be taken as starting a list.
I dunno, depends on whether .act: is considered a "longest token",
I guess.  I could argue it the other way as well, and :bar is a longest
token compared to :.

: (And if this is the case, the one capability that the adverb notation
: provides that the more traditional named parameter notation doesn't
: have is a way to let a particular key to exist without being defined.)

Without being specified, anyway.  The default values are always defined.


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