Dear Fellow Clojurians, 

I'm pleased to annouce release 0.1.0 of pulley.cps, a tool for transforming 
Clojure code into Continuation-Passing-Style. You can find it at 
http://github.com/positronic-solutions/pulley.cps. 

While this is not the first attempt at such a tool, to the best of my 
knowledge it is the most complete to date. The rather lengthy Readme (which 
for now also doubles as User Guide, API Documentation, and design document) 
goes into more detail, but here's a quick run-down of features: 

   - Two macros, cps and cps-fn, serve as primary entry points for 
   transforming code. 
   - Transformed code can call native code (non-transformed functions and 
   Java methods) and vice versa. 
   - Due to the nature of CPS, we get tail-call optimization for free 
   (i.e., all tail-calls within transformed code are naturally TCO'd). Of 
   course, calls from CPS to native code still consume Java stack space, and 
   non-tail calls within transformed code will consume *heap* space. 
   - Dynamic bindings are fully supported, and do not interfere with TCO (
   binding is fully tail-call optimizable). set! is not currently implement 
   for dynamic vars, but due to some recent changes to the way dynamic 
   environments are implemented should be trivial to support. 
   - Since with CPS we explicitly pass the continuation around, it is easy 
   to expose the current continuation to the user. This is accomplished via 
   the function call-cc and its macro analog let-cc. 
   - Exceptions are not currently implemented. However, they are actively 
   being worked on. The expectation here is that exceptions will work pretty 
   much seamlessly with native exceptions, and you will be able to use the 
   same forms (throw, try, catch, finally) as you would in regular Clojure 
   code. 
   - The ability to override native functions with a CPS implementation, in 
   order to provide an optimal experience. For example, clojure.core/apply 
   is overridden to provide an optimized implementation when invoked from CPS 
   code. So if you call apply with a CPS function, continuations, TCO, etc. 
   will still work. 

 Overall, the goal is to be able to automatically transform as much 
"regular clojure code" into CPS while maintaining seamless interoperation 
with "native" Clojure code. The one area I don't think we'll manage to do a 
satisfactory job on are forms that create Java types (reify, deftype, 
genclass, etc.). These forms are currently completely unsupported, and any 
potential future support will most likely consist of simply escaping the 
transformation process when these forms are encountered. Other than that, 
once exception support is completed, I think this goal will be within 
reach. 

Near-term development goals are first to implement exceptions. Then I'd 
like to explore expanding platform support beyond the JVM, namely 
ClojureCLR and ClojureScript. 

Anyway, feel free to give things a try. I greatly treasure your feedback, 
including bug reports and if you have trouble navigating the documentation. 

Have fun, 

Nathan Davis 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to