Florian A¥ÆÝÎann wrote:
> Hi,
> 
> I think it's a excution stack thing, you should look a the C code if you
> want to understand ruby magic.
> 
> Hope I got your question, otherwise the text you got this example from
> describes fairly good why the 'thing' (or aThing) variable 'gets' out of
> scope (its refence is still hold by the Proc object).
> 
> Even in the first case you should got the Object out of scope since you
> passed the reference:
> 
> def n_times(thing)
>   puts thing.object_id
>   return thing
> end
> 
> pi = n_times(23)
> puts pi.object_id
> 
> 
> Regards
> Florian

This example will give a false impression.  Fixnum's always have the 
same ID regardless of scope.  try this smae test with something other 
then a small integer:

var = n_times(Object.new)
puts var.object_id

It will give you a much better sense of what is going on.

John Miller

-- 
Posted via http://www.ruby-forum.com/.