i was looking at the way mixins build into the object models with proxy
objects. (see diagram on pickaxe p.247) i have been working on ONI and
Ned Konz pointed out that i had essentially created a remote-network
proxy object (note: very much still a work in progess):

<pre>

class Module
  public :undef_method   # don't like this but what else is there?
end

module ONI

  class Remote_Object
    
    attr_reader :peer, :oid
    
    def initialize(peer, oid)
      @peer = peer
      @oid = oid
      methods.each { |mid|
        if not ['inspect', 'instance_eval', 'instance_variables',
'__id__', 'id', 'new', 'methods', 'method_missing', 'oid', 'peer',
'to_yaml', 'undef_method', 'class', '__send__', 'send'].include?(mid)
          self.class.undef_method(mid.intern)
        end
      }
    end
  
    def method_missing(mid, *args)
      roargs = []
      args.each { |obj|
        if obj.is_a?(Remote_Object)
          roargs << obj
        else
          oid = ONI::Peer.add(obj)
          roargs << Remote_Object.new(Peer.peer, oid)
        end
      }
      
      req = { 'REQ' => 'call',
              'OID' => @oid,
              'MID' => mid,
              'ARG' => roargs
      }
      
      # connect
      host, port = @peer.split(':')
      port = port.to_i
      session = TCPSocket.new(host, port)
      
      # write
      yreq = req.to_yaml
      yreq_size = yreq.size
      session.write([yreq_size].pack("N") + yreq)
      
      # read
      yam_size = session.read(4).unpack("N")[0]
      yam = session.read(yam_size)
      ro = YAML.load(yam)
    
      session.close
      return ro
    end
  
  end
end

</pre>


taking the two together it occured to me that it would be awesome if
Ruby supported such remote-proxy objects "out-of-the-box".

matz, are you listening?

-transami