^ {是什么意思?

时间:2017-04-07 05:34:00

标签: clojure

在下面的代码中,我注意到^字符之前似乎是一个地图数据结构。什么是^用于什么,或^{用于什么?

(ns temper.core
  (:gen-class)
  (:require [mount.core :as mount]))

(mount/defstate ^{:on-reload :noop}
                http-server
                :start
                (http/start
                 (-> env
                     (assoc :handler (lazy-run 'temper.handler 'app))
                     (update :port #(or (-> env :options :port) %))))
                :stop
                (http/stop http-server))

1 个答案:

答案 0 :(得分:3)

^字符用于元数据。请参阅https://clojure.org/reference/reader#macrocharshttps://clojure.org/reference/metadata

^{:on-reload :noop}(with-meta obj {:on-reload :noop})是等效的。