Clojure type hints syntax

前端 未结 1 2006
旧巷少年郎
旧巷少年郎 2020-12-11 16:26

In the book \"Programming Clojure\" (Halloway, S., (2009). Programming Clojure. Raleigh, NC: Pragmatic Bookshelf.) he shows type hints using the syntax

(defn         


        
1条回答
  •  星月不相逢
    2020-12-11 17:16

    Both are, but in different versions of Clojure: beginning with the 1.2 release, #^ syntax for reader metadata (in particular, type hints) is deprecated and ^ is to be used instead. Note that #^ still works in 1.2; also note that ^foo was shorthand for (meta foo) prior to 1.2, so you have to use the old notation if you use an older release.

    0 讨论(0)
提交回复
热议问题