From: Paul Brannan Date: 2002-04-10T04:19:22+09:00 Subject: Re: capital method names On Wed, Apr 10, 2002 at 02:54:30AM +0900, Yukihiro Matsumoto wrote: > But notice it's done in the compile time. Local variables are > recognized statically at the compile time. Constants are not. Good point. > Anyway, there're both impementation and philosophical reasons NOT to > allow Constant-like method call without parens. > > * unlike local variables, constants are dynamically controlled, so > if you allow constant replacement, it slows down constant > access. [implementation] > > * in fact, I regret method calls just like local variable access, > which you called "replacement". It confuses programs (attribute > replacement like "obj.attr" is OK). I don't think it's good to go > further. [philosophical] Changing this now would certainly break a lot of code. But now that I think about it, I can add a third point to your list: * Constant objects are supposed to be *constant*. If I create a new reference to the object (var = CONST), and come back later and the constant is now referencing a different object, that is likely to break something (since var and CONST are pointing to two different objects). There's also the problem of what to do when the constant exists in a base class, but a method with the same name is defined in a derived class. Picking the constant is faster, but less intuitive. Being able to call methods with capital names without parens would be nice, but I think I can work around it. Paul