From: Dave Thomas Date: 2000-07-15T10:46:56-05:00 Subject: [ruby-talk:04039] Re: Pluggable functions and blocks matz@netlab.co.jp (Yukihiro Matsumoto) writes: > String.instance_method(:gsub).call("abc", /a/, "b") # => "bbc" > String.instance_method(:gsub).call(42, /a/, "b") # => TypeError Works great, but I'm wondering. That mixed parameter list doesn't seem very elegant. How about keeping on with the current rule: you can only call a Method object, one that's bound to a receiver. Then provide UnboundMethod#bind_to, which returns a Method. Then you'd rewire the above as unbound = String.instance_method(:gsub) unbound.bind_to("abc").call(/a/, "b") # => "bbc" You could then provide the symetrical Method#unbind bound = "abc".method(:gsub) unbound = bound.unbind # => UnboundMethod This all seems to have a clearer semantic, and also allows you to change the state of method objects on the fly. Anyway, I know what you're doing really. You're just trying to make sure that we _never_ get this book finished ;-) Regards Dave