From: Albert Schlef Date: 2010-03-25T18:31:31+09:00 Subject: Re: On procs and methods David Espada wrote: > Hi. > > I have a question about procs and methods. Why is not possible to invoke > them in same form: > > * proc: foo[param1, param2] > * method: foo(param1, param2) > > Only curious. Thanks for your ideas. (The following is only a guess.) Ruby lets you drop the parenthesis. Now, look at this: a = bobo Suppose 'bobo' is a variable that points to a proc. Whould that statement assign it to 'a', or invoke the proc and assign the result to 'a'? You can't know. David Masover gave the following example... foo()(param1, param2) ...and since Ruby lets you drop the parenthesis, you should be able to write is as: foo(param1, param2) ...but that's a problem because there's no way to distinguish between calling foo with arguments to calling foo and then calling the returned value. In languages like JavaScript the parenthesis are mandatory so they don't have similar problems. -- Posted via http://www.ruby-forum.com/.