Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Random idea - private, blocks, constants" > on Fri, 15 Dec 2006 04:15:06 +0900, "Daniel Berger" <djberg96 / gmail.com> writes: > > |Do you object to the existence of private/protected then? You could > |say the same thing for methods. As I said, private is advisory only, > |but it does have its uses. For example, code coverage automation tools > |could be configured to ignore private methods (which is what I'm > |guessing most of them do by default). > > The demand for private constants are much lower than private methods, > since constants are not overridden by subclasses, i.e. > > class Foo > Foo=1 > def foo > p "foo" > end > def bar > p Foo > p foo > end > end > class Bar < Foo > Foo=2 > def foo > "bar" > end > end > Bar.new.bar > > prints 1 and "bar", so that they need not to be protected by > visibility. They are, even if they are accepted, just for narrowing > constants list. How does method lookup differ from constant lookup? It has always suprised me a little that FOO and FOO() are both legal and different. trans.