On 8/30/07, Trans <transfire / gmail.com> wrote:
>  Cool. It will be interesting to see how it turns out.

Well, I've hit a snag as a result of two properties of ruby:

1. If you write "def foo.bar() end", bar is guaranteed to be a
singleton method on something regardless of the value of foo. (You can
verify this on lines 1695-1709 of parse.y and lines 3919-3950 of
eval.c.)

2. An unbound method (such as what you get by calling
foo.method(:bar).unbind) can only be bound to an object of the same
type as the original receiver. For singleton methods, this means that
they can only be bound to the very same object.

Put these together and it means that once bar has been defined in this
way it can never become an instance method.

If only there were some way to get the body of an unbound method as a
string I could eval it again in the appropriate context. Short of
that, I see no way to make this notation work.

kr