orthecreedence / blackbird

Common Lisp promise implementation (successor to cl-async-future)
83 stars 10 forks source link

Making DO-FINALLY more useful #10

Closed archimag closed 9 years ago

archimag commented 9 years ago

DO-FINALLY must finish the returned promise with the values of the given promise. It's important for a code like:

(defmacro with-mongo-db ((db-symbol) &body body)
  (with-unique-names (client1 client2)
    `(let (,client1)
       (chain (mongo:create-mongo-client :cl-async)
         (:attach (,client2)
           (setf ,client1 ,client2)
           (make-instance 'mongo:database :mongo-client ,client2 :name "test"))
         (:attach (,db-symbol)
           ,@body)
         (:finally ()
           (mongo:mongo-client-close ,client1))))))
orthecreedence commented 9 years ago

Your version is more correct, thank you for the update!