使用 \~I
和 \~_
等,在许多场景下都会失败,最简单的一个例子是
Clojure 1.6.0 和 1.5.1
user=> (clojure.pprint/cl-format true "~I") ClassCastException java.io.PrintWriter cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2180) user=> (clojure.pprint/cl-format nil "~I") ClassCastException java.io.StringWriter cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2180) user=> (clojure.pprint/cl-format nil "~_") ClassCastException java.io.StringWriter cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2180)
Clojure 1.4.0
user=> (clojure.pprint/cl-format true "~I") ClassCastException java.io.OutputStreamWriter cannot be cast to clojure.lang.IDeref clojure.core/deref (core.clj:2080) user=> (clojure.pprint/cl-format nil "~I") ClassCastException java.io.StringWriter cannot be cast to clojure.lang.IDeref clojure.core/deref (core.clj:2080) user=> (clojure.pprint/cl-format nil "~_") ClassCastException java.io.StringWriter cannot be cast to clojure.lang.IDeref clojure.core/deref (core.clj:2080)
在其他实现中这些方法有效,例如 clisp,在这些简单场景下创建空输出
> (format t "~I") NIL > (format nil "~I") "" > (format nil "~_") ""