It occurs to me that a simpler no-library-needed way to get something
like actors in Clojure would be to just send forms over the network to
other nodes.

The simplest thing would be to send forms to *eval*. But that requires
some serious security precautions. Like, say, authentication plus
encryption of the links.

Another thing would be to set up an "agent server" which receives
forms the reader can read. These would *not* be sent to eval; instead,
just passed through the reader (with read-eval false to close a
possible security hole) and then (apply send-off (map my-resolve
form)). The first element of the form should, therefore, name an agent
on the target node; the next, a function that exists in the namespace
where the agent server is in that node; and optional arguments to that
function. If the nodes all share a common codebase then the defs and
defns will be the same, including the defs of agents and the defns of
functions to invoke them on.

The my-resolve function is a tricky detail: it needs to resolve
symbols to Vars and leave everything else alone, a kind of "weak
eval".

This could still be maliciously misused, by triggering arbitrary
actions by arbitrary actors (enabling cheating in games, for instance)
and by sending lots of CPU-heavy requests as a denial of service
attack. Authentication and encryption would still be a good idea here,
but not using full eval on the traffic adds another layer of
protection. Someone who cracks the encryption can cheat at your MMORPG
but not send, say, (System/exec "rm -rf /"). (Not running the nodes as
root provides still more damage limitation, of course.)

Also, handing the guys that might want to cheat the decryption key
would be stupid, so this protocol would obviously be used internally
by the "server" (a distributed network of game hosting machines) with
some other, much less generally-capable protocol between these and
clients to limit the possibilities for cheating using a nonstandard
client. (Things analogous to client-side gold-farming bots or
super-reflex-equipped combat bots will always be possible, of course.
There's no in-principle way to be sure it's carbon rather than silicon
sitting in the player's chair, other than if commands are sent
absurdly fast. Even 24/7 farming for weeks without letup could be
humans working in shifts.)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to