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 >> language-dev
language-dev
Re: Iterator Syntax
by Mathieu Bouchard other posts by this author
May 8 2002 3:57AM messages near this date
Re: Iterator Syntax | Re: Iterator Syntax
On Wed, 8 May 2002, Buggs wrote:
>  On Tuesday 07 May 2002 16:24, Glen Starchman wrote:
>  > On Tuesday 07 May 2002 02:47 am, Donal K. Fellows wrote:
>  > "hello".each(3) { |x| print ("chars=%s", x)
>  what about
>  "hello".each(3)->x  {print ("chars=%s", x)}
>  if you still have "->" spare
>  think
>  x <-"hello".each(3) {print ("chars=%s", x)}
>  is funny

putting the block parameters at the beginning of the block syntax like
{|x| ... } is well-justified: those parameters belong to the block, not to
the call. This is why the same kind of syntax was chosen in languages like
Smalltalk, Self, and Ruby.

The params belong to the block because it makes it easier to pass the
blocks around from call to call, or store them in variables.

________________________________________________________________
Mathieu Bouchard                   http://hostname.2y.net/~matju
Thread:
Glen Starchman
Donal K. Fellows
Glen Starchman
Pixel
Glen Starchman
Buggs
Mathieu Bouchard
Buggs
Mathieu Bouchard
Glen Starchman

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved