Hi,

At Mon, 8 Sep 2003 08:36:57 +0900,
"Sean O'Dell" <sean / cSePlsoAfMt.com[REMOVE_THE_SPAM]> wrote:
> >>> Can you give a link to this discussion?  I haven't been able to find
> >>> it on google, rubygarden, etc.

Since Excite translation service was very funny, although I
tried, excuse bad translation.

[ruby-dev:8372] Re: keyword ( or hash ) argument
# answering the question how to write a method definition has
# keyword arguments.
| It is same as Python.  That is, optional arguments become
| keyword arguments.  And, you can get a Hash like Symbol =>
| value with **.
| 
| Suppose
| 
|   def foo(a=4, b=5, c=6, **keys)
|   end
| 
| and by invoking as foo(a: 1, d: 7, k: 44), you'll get
| 
|   a=1, b=5, c=6, keys = {:d=>7, :k => 44}
| 
| Unless there is **, undefined keywords occur error.

> Could a "calling context" be prepared as an object, which allows you to 
> set parameters as methods and then "make the call" in one atomic action? 
>   By this I mean, the code could do something like:
> 
> something = "this is a string"
> call = Call.new(something, :slice)
> call.params["pattern"] = /is/
> call.call()
> print call.result

What about this?

  module Kernel
    def calling(meth, *args)
      meth = method(meth)
      Proc.new {meth.call(*args)}
    end
  end
  p "this is a string".calling(:slice, /is/).call

-- 
Nobu Nakada