RE: Faking Clojures

James Ladd <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
A quick thought might be to use ASM on the client machine to generate the bytecode.

Then send the resulting bytearray to the remote machine where it is loaded with
a classloader and executed.  You would need to pass the arguments.

> Date: Wed, 19 Jan 2011 21:45:41 -0500
> From: [email protected]
> To: [email protected]
> Subject: [asm] Faking Clojures
> 
> Hey,
> 
> I have an interesting problem here and I'm wondering if ASM can help
> me. I want to write a method that takes two arguments. A clojure alike
> function and a list of arguments. The function receives the arguments
> at some future point in time when it's executed.
> 
> The tricky part is, the execution happens on some remote machine. That
> means I want to extract the function's bytecode, send it along with
> the arguments to some remote machine, turn it back into a class and
> execute it.
> 
> I've done something similar with Runnables in the past (with plain
> Java) but it was overall to fragile to be practical.
> 
> Thanks,
>  Roger
> 
> 
> public interface Function {
>     public void invoke(Object[] args);
> }
> 
> Object[] args = new Object[] { "Hello", "World!" };
> doSomething(new Function() {
>     public void invoke(Object[] arguments) {
>         System.out.println(Arrays.asList(args));
>     }
> }, args);
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.