[#407] New feature for Ruby? — Clemens.Hintze@...

Hi all,

27 messages 1999/07/01
[#413] Re: New feature for Ruby? — matz@... (Yukihiro Matsumoto) 1999/07/01

Hi Clemens,

[#416] Re: New feature for Ruby? — Clemens Hintze <c.hintze@...> 1999/07/01

On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:

[#418] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/01

Hi

[#426] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/02

Hi,

[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>

Hi,

21 messages 1999/07/09
[#441] Re: Now another totally different ;-) — matz@... (Yukihiro Matsumoto) 1999/07/09

Hi,

[#442] Re: Now another totally different ;-) — Clemens Hintze <c.hintze@...> 1999/07/09

On Fri, 09 Jul 1999, you wrote:

[#443] — Michael Hohn <hohn@...>

Hello,

26 messages 1999/07/09
[#444] interactive ruby, debugger — gotoken@... (GOTO Kentaro) 1999/07/09

Hi Michael,

[ruby-talk:00489] Re: coderefs

From: Clemens Hintze <c.hintze@...>
Date: 1999-07-14 06:14:54 UTC
List: ruby-talk #489
On Wed, 14 Jul 1999, you wrote:
>Hello,
>I was wondering why a proc has to be called via
>>> ...
>>> 
>>>   method = obj.method(:method_name)
>>>   mathod.call(args)
>>> 
>>> ...
>
>as opposed to using the parentheses; something like
>
>   f = obj.method(:method_name)
>   f(args)
>
>would be far cleaner.  Does the syntax f() have a fixed, predefined meaning?  

I don't know (matz?), but in the meanwhile you could use

   f = obj.method(:method_name)
   f[args]

I have had a quick look into the sources. I think, that `()' is only
used to lexically group expressions. There is nothing behind.
Whereas `[]' is really an operator, which can be mapped to a method,
if desired.

In  your example above `f' would contain a `Proc' instance. The class
`Proc' overwrites the operator `Proc#[]' to perform a method call.

>
>cheers,
>Michael

Same to you,
\cle

In This Thread