Transparent proxies are "wrapper" objects
for actual objects, which the programmer can use transparently, as if it
were the actual object. We use our framework to implement futures, and add
lazy evaluation to Java.
Futures are placeholder objects for the actual (and possibly not yet computed)
result of an asynchronous method call.
Using our proxy framework, one can simply add futures using this code:
result = Async.invoke(tm, o.m());
which means that method m() of object o is called in a new thread,
using a Thread Manager (or Executor) object tm. The thread manager
specifies the policy of execution,
which can be "thread per object", "thread pool", "fork", etc.
The result that is returned
by the expression is not the actual returned result of the call, but a "placeholder", or a "future".
The synchronization necessary to use result is automatically inserted by our
transformation, which uses an analysis to find the latest possible point for such a "claim" of
the future, without the programmer having to know where this happens. Such a transformation maximizes the
code that can run in parallel, something that could take a lot of time for a programmer to do.
Proxyc is a tool that facilitates proxy programming in Java, by using a static analysis to make the use of proxies transparent to the programmer. The result of the analysis is used to re-write the program, inserting all the necessary code for wrapping objects into proxies, and unwrapping the proxy when necessary.