Default argument values for blocks

-1. Sucks.

Dan

···

-----Original Message-----
From: Daryl Richter [mailto:daryl@brandywine.com]
Sent: Wednesday, October 12, 2005 8:00 AM
To: ruby-talk ML
Subject: Re: Default argument values for blocks

Devin Mullins wrote:
> Christophe Grandsire wrote:
>
>> Hey, what about ":(foo="bar"){puts foo}"? It's still not beautiful
>> but
>> it's
>> still less annoying, and in Ruby we are already used to
see colons at the
>> beginning of a word. Of course, overloading ":" may not be
considered
>> a good
>> idea, but it shouldn't be a parsing problem as this one
would always be
>> followed by a "(" (and that doesn't happen with symbols). And:
>>
>> collection.each:(foo="bar"){puts foo}
>>
>> isn't that bad :slight_smile: .
>>
>>
> +1
>
>

+1. Furthers Ruby/Smalltalk harmonic convergence. :slight_smile:

--
Daryl

My $0.02:

I feel that the arrow syntax yielding a standalone Proc (my_proc = ->(x) { .. }) is distinctly out of place compared to existing Ruby syntax. I would give my support to turning lambda into a keyword, with the syntax (my_proc = lambda(x) { ... }) for the simple reason that it is reminiscent of method call syntax with an accompanying block (for example open("blah") { |f| ... }).