Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defmacro with-open* [bindings & body]
(let [[sym exp & others] bindings]
(if sym
`(let [~sym ~exp]
(with-open* [~@others] ~@body)
(catch Throwable t#
(. ~sym close)
(catch Throwable t2#
(.addSuppressed t# t2#)
(throw t#)))
(throw t#)))
(. ~sym close)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment