Hi --

On Fri, 11 May 2007, Vasco Andrade e silva wrote:

> I agree with you (Gavin Kistner). The question is, what could you loose
> if self was always set as it is with class_eval, instance_eval, etc.?
> You could still do:
>> def create( name )
>>  person = Person.new( name )
>>  yield person
>>  p person
>> end
>>
>> create( :gavin ){ |person|
>>  person.age = 32
>>  person.grow_older
>> }
> as all the other things.
>
> For me the question is: What's the purpose of not always setting self to
> yield context?

Why constrain it to be one way or the other, instead of being able to
do either?  Besides, I want to be able to do this:

   @x = 1
   some_method {|n| puts n + @x }

and not have it be some other object's @x.


David

-- 
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    (See what readers are saying!  http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)