From: gabriele renzi Date: 2004-06-29T04:32:58+09:00 Subject: Re: (oddity) applying objects with #call() implicitly il Mon, 28 Jun 2004 15:38:03 +0200, "Robert Klemme" ha scritto:: >> "p" may stand for self#p, or a local variable named "p". > >True. It might be inconsistency then, because for a method "foo" and >"foo()" are identical (apart from, that the latter form does not have the >ambiguity) but you proposed change would introduce a significant >difference between "foo" and "foo()". this is true. It feels better to me, somehow, but that's just my opinion. >You probably guessed that I don't like this very much. :-) You don't like my idea! You #�@* It's ok for anyone to dislike this, we're just chatting about an idea, nothing really important[1] :) >Well, there >are also reasons: ruby could no longer determine at compile time the >semantics of this code: > >def foo(x) > x("bar") >end > >Because x("bar") could be a method invocation or it could be an invocation >of the Proc instance x. >And since we don't have type declarations in Ruby >you couldn't get this to work. That's especially true because when foo is >defined there need not be a method x at all. I see, even if I fail to see how this is a problem. Say, #x could not be defined at the time of #foo call, so ruby has to check for something anyway. In what it differs from checking the type of x ? >> It is better because it looks like () yet it's worst because it just >> mimics something hiding it's meaning, > >Could you elaborate that? I don't get the point. My understanding was, >that you were looking for a nicer more intuitive syntax to invoke a Proc >instance. not a nicer as in 'less typing'. just nicer as in 'mimic the right thing', say: foo 10 and foo(10) and foo.call 10 all gives me the feeling of a method call/function application, where foo[10] is array indexing to me. Obviously the inconsistency is not really removed using the trick I propose, just moved somewhere else. It just happens I'd prefer seeing it there instead of here :) [1] ok, people use to die for Ideas, but that ones are capitalized.