Joel VanderWerf wrote:
> Thanks for the summary, Chris.
>
> Could this be solved by having a hash of method objects, accessed
> through a method on Kernel?
>
> pm = Kernel.pervasive_methods
>
> m = pm["class"] # => #<UnboundMethod: Object#class>
> "foo".bind(m).call #=> String
>
> The values in the hash are always the original implementations.
>
> No new syntax or modules, just one new method.

Yes, that can be done. In fact:

require 'facets'
require 'kernel/as'

  "foo".as(Kernel).class #=> String

The thing is though, do you really way to put ".as(Kernel)." or
whateverfor every pervasive call?

I know Ara says he doesn't want to get rid of the orginal methods. But
then it marginizes the whole point of it. Either we are free to use
methods such as #class and #send for our own purposes or we are not.
Trying to have it both ways won't be nearly as effective. We will still
be afraid to override those methods. I'm not saying we have to get rid
of those methods neccessarily, but I am saying the pervasive methods
would/should become the more common form. So the syntax should be
something very concise.

T.