From: Joel VanderWerf Date: 2001-11-03T04:39:50+09:00 Subject: [ruby-talk:24193] Re: private instance_variable? Yukihiro Matsumoto wrote: > > Hi, > > In message "[ruby-talk:24065] Re: private instance_variable?" > on 01/11/01, Lars Christensen writes: > > |Related to this, will there be private/protected constants? I don't > |particularly enjoy that this is possible: > | > |$ ./ruby -e 'p String::Process::Regexp::Enumerable::IO::String.new("foo")' > |"foo" > > I admit it's annoying, but not that much (bacause you're not forced to > do so). > > matz. Why be annoyed? It's useful, at least as a default behavior: class Base attr_accessor :name def initialize name @name = type::String.new name end end class A < Base class String < String def downcase self.dup end end end class B < Base end a = A.new "Lars" b = B.new "Matz" print "Hello, ", [a, b].map { |s| s.name.downcase }.join " and " ==> Hello, Lars and matz -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512