support for async/future expressions?
we could support an alternative buffer inside the RenderContext so that when you output a value which is-a Future of some kind
http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html
http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/actors/Future.html
or Future from Akka etc
then we could provide a different kind of buffer which rather than eagerly converting objects into text, we just store the objects in a ListBuffer[_] or something; then when all of the expressions have been added to the list we then have a separate pass of the List[_] converting all objects to Strings; which in the case of a Future we'd do a get to block.
We could then have a completely async code generator, where all expressions are evaluated asynchronously, wrapping the expressions in some syntax; or we could use some actor library to make expressions async (creating a Future for the expression), or using something like HawtDispatch - so folks can choose exactly which expressions should be evaluated async - or the domain services themselves could just return Future[T] instead, hiding the async stuff from the templates completely.
http://hawtdispatch.fusesource.org/
e.g. in a template
{{{
some text ${^{foo.someRemoteInvocation}} some text ${x + 5}
}}}
http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html
http://www.scala-lang.org/archives/downloads/distrib/files/nightly/docs/library/scala/actors/Future.html
or Future from Akka etc
then we could provide a different kind of buffer which rather than eagerly converting objects into text, we just store the objects in a ListBuffer[_] or something; then when all of the expressions have been added to the list we then have a separate pass of the List[_] converting all objects to Strings; which in the case of a Future we'd do a get to block.
We could then have a completely async code generator, where all expressions are evaluated asynchronously, wrapping the expressions in some syntax; or we could use some actor library to make expressions async (creating a Future for the expression), or using something like HawtDispatch - so folks can choose exactly which expressions should be evaluated async - or the domain services themselves could just return Future[T] instead, hiding the async stuff from the templates completely.
http://hawtdispatch.fusesource.org/
e.g. in a template
{{{
some text ${^{foo.someRemoteInvocation}} some text ${x + 5}
}}}
Leave a comment