Robert Klemme wrote in post #949407:
> I believe Josh expected the former (a local Array with proxies).  DRb
> seems to apply some automatism, i.e. if there is at least one
> DRbUndumped in an Array the whole Array is proxied.  If you only place
> String, Fixnum etc. in the Array then you actually get a local copy.
>
> I have no idea why this automatism is in place

The response is a single object, and DRb just Marshals it to get a 
String to send over the wire. If it can't be marshalled, then you get a 
proxy for the whole thing instead. All that including DRbUndumped does 
is to make the whole thing unmarshallable:

  module DRbUndumped
    def _dump(dummy)  # :nodoc:
      raise TypeError, 'can\'t dump'
    end
  end

So, an Array which contains even one object with DRbUndumped is itself 
not marshallable.

If you want to send over an array of proxies, well, you could construct 
explicit DRbObject wrappers, but I just noticed this in the drb/drb.rb 
source:

  class DRbArray
    def initialize(ary)
      @ary = ary.collect { |obj|
        if obj.kind_of? DRbUndumped
          DRbObject.new(obj)
        else
          begin
            Marshal.dump(obj)
            obj
          rescue
            DRbObject.new(obj)
          end
        end
      }
    end

    def self._load(s)
      Marshal::load(s)
    end

    def _dump(lv)
      Marshal.dump(@ary)
    end
  end

So why not just make one of those?

-- 
Posted via http://www.ruby-forum.com/.