[postmodern-devel] with-connection is strange...

Lucas Hope lucas.r.hope at gmail.com
Tue May 26 04:55:19 UTC 2009


Hi there,

The macro with-connection doesn't seem to work as I would expect. It
seems two macros were merged...

I am curious as to why the following definition is used:

(defmacro with-connection (spec &body body)
  "Like with-connection, but evaluate the specification list."
  `(let ((*database* (apply #'connect ,spec)))
    (unwind-protect (progn , at body)
      (disconnect *database*))))

Note the documentation above.

I think a more standard "with-" macro doesn't evaluate the spec (like below).

(defmacro with-connection (spec &body body)
  "Like with-connection, but evaluate the specification list."
  `(let ((*database* (connect , at spec)))
    (unwind-protect (progn , at body)
      (disconnect *database*))))

What's the reasoning here?

-Luke




More information about the postmodern-devel mailing list