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

Re: [svn:perl6-synopsis] r8637 - doc/trunk/design/syn

Thread Previous
From:
Larry Wall
Date:
April 10, 2006 19:38
Subject:
Re: [svn:perl6-synopsis] r8637 - doc/trunk/design/syn
Message ID:
20060411023810.GA16531@wall.org
On Mon, Apr 10, 2006 at 10:32:33PM -0400, Joe Gottman wrote:
:    How does the "sub" keyword fit in here?  Is there any difference between
: the lines
: 	return {say "Hello World";};
: and 
: 	return sub {say "Hello World";};
: ?

Effectively, no, for these examples.  In the second case you could
omit the "return" since you're not returning a bare block, so it's
not ambiguous.  (The other difference is that the explicit sub form
allows you to return from within the closure.)

Larry

Thread Previous


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