From: Gavin Sinclair Date: 2003-11-28T12:59:02+09:00 Subject: Re: Controlled block variables From T. Onama: >> In short, the message-passing paradigm is paramount in Ruby. You may >> say that 'foo.aproc is a Proc object', but the reality is that >> 'foo.aproc' is the result of sending the message 'aproc' to 'foo'. >> Nothing more, nothing less. And there are good reasons why that won't >> change. Making parens optional is just a superficial reason. > > Thanks Gavin. I read it over. And I certainly understand the > distinction. To sum up: foo.aproc is sending a message called 'aproc' > to the object 'foo'. But it's still returning an Proc object. Yes? Maybe. It could return a String, nil, a FroBoz, anything really. > There's probably something obvious that I'm just overlooking here, but > I don't see the reason why Ruby can't infer the #call message when a > Proc object (or Method object for that matter) is returned given with > parens. > > aproc() # -> aproc.call() > > in a fashion similiar to how it can infer self as a reciever. aproc() calls the method 'aproc' (sends the message :aproc) with no arguments. It can't add a magic :call message in there. Maybe - I'm not sure - you're under the misunderstanding that, or maybe you're proposing that the following should occur: class Example def ameth(x) x + 1 end end e = Example.new e.ameth # returns Proc # return value equiv. to proc { |x| x + 1 } # Instead of # e.ameth -> ArgumentError: 0 for 1 This is the "methods as first class objects" wish that Python implements. Is that what you're proposing? If so, I missed it or misunderstood it in previous messages. I sympathise with the wish that methods be first class, and that you can pass them around, but when I red Jim Weirich's article (http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc) that door forever closed in my mind. If you can clear up the misunderstandings I have about where you're coming from, I'd like to hear your proposals. Cheers, Gavin