cl-async-future is a future (or "promise") implementation that allows a simple abstraction for values that may or may not be available yet. It is particularly useful for transforming CPS-style code into (what appears to be) stack-based programming (this example uses cl-async
(defun timer (seconds &key threaded)
"Fire an asynchronous timer"
(let ((future (make-future)))
(as:delay (lambda () (finish future t)) :time seconds))
(format t "starting timer!~%")
(alet ((done (timer 2)))
(format t "done!~%")))
Here's we run an asynchronous operation which would normally need a callback, and replace it with what looks like real lisp code (in this case "alet").
cl-async-future comes with a full set of macros to abstract asynchronous programming and make it more natural (including error handling).
Topics: system programming networking concurrency