On Fri, Apr 25, 2008 at 6:52 PM, Eric Mahurin <eric.mahurin / gmail.com> wrote: > > On Fri, Apr 25, 2008 at 8:13 AM, Paul Brannan <pbrannan / atdesk.com> wrote: > > > > > On Fri, Apr 25, 2008 at 08:34:20PM +0900, Nikolai Weibull wrote: > > > Why not abolish :: altogether and disallow methods that begin with an > > > uppercase letter and reserve those explicitly for constants (that > > > already must be initially capitalized)? > > > > I don't really like uppercase methods, but I wouldn't want to do without > > Integer() and Float(). > > > > I think that many/most cases where uppercase methods are used is when it > matches a class name and you want some Class#new type functionality. > > The namespace between class/module methods and constants could be merged and > you still could get this behavior if we had one more thing: callable > objects. The Integer() and Float() methods would correspond to calling the > Integer and Float classes. > > This is an area where I think Python is a bit more elegant. There is no > reason for separate "." and "::" operators. "." simply does object lookup > within a scope. That object could be a method which you can call with the > () operator. > > But, I think something elegant could exist for Ruby and still use the same > syntax. But, the first thing you need is to eliminate the overlap between > "::" and "." as David suggested. "." could simply be treated as two > operations - "::" (lookup within scope) + "()" (call). So, Ruby's "::" > would be equivalent to Python's ".". Here would be a breakdown of this > proposal (replaced currying with calling): I feel your initial idea is brilliant, and I did say so, but now I feel you are overdoing it a little bit, but I am open to think about it longer > > a.b <=> a::b() a.b <=> a::b.call would be nicer I think, but I am a notorious paren hater ;), many others are not I admit freely. > a.b x,y,z <=> a::b(x, y, z) > a.b(x,y,z) <=> a::b(x, y, z) # parens not needed for "." sure :) > a::b <=> a.method(:b) or a.const_get(:b) # namespaces merged for Module but this is a small detail I would be very happy if Ruby would be modified as you suggested above :) Cheers Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein