Hi --

On Tue, 21 Mar 2006, Shea Martin wrote:

> Jeffrey Schwab wrote:
>
>> So...  You want an exception to be thrown, but you don't want to throw an 
>> exception?  Please show me what I've missed.  Are you saying that 
>> specifying the &p_block parameter should make the block mandatory 
>> automatically?
>
> I am not saying it *should*, but just curious why specifying a block, does 
> not make it mandatory (automatically)?  Specifying a normal parameter, makes 
> it mandatory (automatically.  It just seems odd that the two are treated 
> differently.  Just my $0.02.

It's hard for me to answer, because I don't understand why one would
assume, a priori, that they *should* be treated the same :-)  But in
practice, the code-block facility works out better, I think, the way
it is.  The method can easily branch on existence or non-existence of
a block, and it's easy to write methods that can work with or without
a block.  I guess I view the &block thing as a special concession to
the possibility that one might want to handle the block as an object
(rather than as a syntactic construct), but not the heart of the
matter.


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" chapters now available
from Manning Early Access Program! http://www.manning.com/books/black