Iterators within Madeleine

I’m currently stumped in how to implement iterators within the
confines on a Madeleine environment. It’s very easy to just expose the
entire instance with all its variables; but I want to build an "each"
to be run via the “execute_command” method in Madeleine. Is this
possible?

A scenario using the dictionary server sample program would be:
To access the key/value pairs iterative via “each” within the confines
of full concurrency protection.

Therefore, at the client, I should be able to do:

dictionary.each { |key,val|
print “key=#{key}, val=#{val}\n” # read access
dictionary[key] = val + “foobar” # write access
}

On top of that I should be able to do the above with multiple clients.

Is the above feasible or am I dreaming??.. :-}

Squidster wrote:

I’m currently stumped in how to implement iterators within the
confines on a Madeleine environment. It’s very easy to just expose the
entire instance with all its variables; but I want to build an “each”
to be run via the “execute_command” method in Madeleine. Is this
possible?

Hi Squidster,

I’m not sure if it’s directly possible, but there should be some way of
working around it. Distributed Ruby itself (which the dictionary example
below uses) has a lot of code dealing with iterators, and still has some
limitations on them. (Not to mention the bad performance you get by
calling a remote object lots of times). But maybe you can get some ideas
from studying that code anyway.

A scenario using the dictionary server sample program would be:
To access the key/value pairs iterative via “each” within the confines
of full concurrency protection.

Therefore, at the client, I should be able to do:

dictionary.each { |key,val|
print “key=#{key}, val=#{val}\n” # read access
dictionary[key] = val + “foobar” # write access
}

Had this been on the server it wouldn’t be a problem, you could just
wrap the entire snippet of code in a command object and it would be
done. I think the easiest way is just to do the entire operation of the
server and provide a wrapper method that the clients use.

On top of that I should be able to do the above with multiple clients.

Is the above feasible or am I dreaming??.. :-}

Don’t know if I was to any help, but I like the thought that someone
would be dreaming about my code. :slight_smile:

/Anders

···

A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se
Stockholm, Sweden |