--- itsme213 <itsme213 / hotmail.com> wrote:
> > We are also talking about inside the class, so you know the
> 
> It affects other places as well, such as instance_eval.

Using instance_eval breaks encapsulation anyways (you have full
access), so I don't see much differnce from self.foo= and
@foo=.

Personally, I think using instance_eval regularly is bad
practice since it breaks encapsulation.  My guess is that many
times it is done so that some code doesn't have a specify a
receiver:

foo.bar {
  abc(1,2,3)
  xyz(4,5,6)
}

where #bar did an instance eval on the block using some object
in foo (including foo itself).  I'd say this is better:

foo.bar { |o|
  o.abc(1,2,3)
  o.xyz(4,5,6)
}

where #bar simply yielded the object in foo to the block.

A little more typing, but you don't break encapsulation and you
don't have to question what "self" is in your blocks.



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com