On Tue, 4 Apr 2006, Trans wrote:

> Ths is used inside an object that clears out most of the Kernel methods
> (like BlankSlate). It allows one to get at those methods.
>
>  class BasicObject
>
>    # ... undefines Kernel methods ...
>
>    class Instance < self
>      define_method( :method_missing ) do |meth, *args|  # &blk|
>        Kernel.instance_method(meth).bind(self).call(*args) # ,&blk)
>      end
>    end
>
>    def instance
>      @__instance__ ||= Instance.new
>    end

maybe

   class BasicObject

     Self = Class.new(self) do
       ...
       ...
       ...
     end

     def Self() @__self__ ||= Self.new end
   end

so

o = BasicObject.new
o.Self.p 42

??

in fact, you can even

     def self() @__self__ ||= Self.new end

though that might be confusing, maybe...

     def __self__() @__self__ ||= Self.new end

food for thought.

regards.


-a
-- 
share your knowledge.  it's a way to achieve immortality.
- h.h. the 14th dali lama