Hi --

On Mon, 25 Sep 2006, Rick DeNatale wrote:

> On 9/24/06, dblack / wobblini.net <dblack / wobblini.net> wrote:
>> 
>> I am fairly certain that the return value can never be captured.  At
>> least I can't figure out how to do it.
>> 
>> In this:
>>
>>   def raise_value
>>     x = raise
>>   rescue
>>     x
>>   end
>>
>>   p raise_value   # nil
>> 
>> I'm pretty sure that x is nil because of the thing where the parser
>> sees an assignment and defines the variable.  I don't think an
>> assignment ever actually takes place -- as witness the fact that:
>>
>>    x = raise || 1
>> 
>> also leaves x as nil.
>
> But try:
>
> x = raise rescue nil || 1
>
> Of course this is a trivial example, but the point is that raise can
> in fact have a value.

Even more trivial:

   x = raise rescue 1

:-)  But I'd still say that the return value of the call to raise is
not what's being captured in x.


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org