it seems tuplespace's read operation is not considered important
somehow. consider this:
class HelloWorld
# include DRbUndumped
attr_writer :str
def initialize(str)
@str = str
end
def _dump#(*args, &block)
# Marshal.dump(@str, *args, &block)
end
def HelloWorld._load#(*args, &block)
# HelloWorld.new(Marshal.load(*args, &block))
end
def to_s
@str
end
end
i created a simple hello world class, and released its object into the
tuplespace. i then created a simple process doing indefinite loop of
reading the object, and another one reading _and_ modifying the object.
so what is the problem you say? i don't want to use pass-by-reference
and DRbUndumped, so that each reader process actually gets a copy of the
object instead of a reference to it. to do that, i have to define my own
marshalling method. after a few run, i realized that the tuplespace
seems only need to see a _dump and a _load, instead of marshal_dump and
marshal_load, and that the tuplespace doesn't even bother if there is no
parameter given in the _dump and _load or if there is no operation
within (returning nil). but the result is still a pass-by-reference. try
uncommenting the above class code, and something similar to this will
occur:
in `init_with_ary': undefined method `size' for
#<DRb::DRbUnknown:0x28d21d0> (NoMethodError)
any suggestion, or is tuplespace's read operation isn't as important as
take operation? is this a flaw?
···
--
Posted via http://www.ruby-forum.com/.