Dan Doel <djd15 / po.cwru.edu> wrote in message news:<401AE1AC.6090201 / po.cwru.edu>... > You can do it. > > [dolio 05:55:13 ~]$ cat prac.rb > #!/usr/bin/ruby > > class Foo > attr_reader :bar > end > > obj = Foo.new > > obj.instance_eval { @bar = 3 } > > p obj.bar > [dolio 05:55:17 ~]$ ./prac.rb > 3 > [dolio 05:55:23 ~]$ > > However, I think that, generally, this isn't a bad thing. In both Ruby and > Python, it's obvious what you're doing. You're not likely to type that in > by accident. Hiding instance variables may be good programming practice, > but that doesn't mean you shouldn't be able to get at them if it's > absolutely > necessary. > > You shouldn't use that kind of thing a lot, but you have to trust people not > to be stupid. > > - Dan Dan, Is there a safety level ( http://www.rubycentral.com/book/taint.html ) that can prevent this methods from being used?