Skip to content

Commit

Permalink
Change eval-supporting atoms to volatiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes committed Jun 5, 2017
1 parent a711625 commit 0f29414
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions planck-cljs/src/planck/repl.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1687,23 +1687,23 @@
(process-execute-source source-text expression-form opts))))))))


;; The following atoms and fns set up a scheme to
;; The following volatiles and fns set up a scheme to
;; emit function values into JavaScript as numeric
;; references that are looked up.

(defonce ^:private fn-index (atom 0))
(defonce ^:private fn-refs (atom {}))
(defonce ^:private fn-index (volatile! 0))
(defonce ^:private fn-refs (volatile! {}))

(defn- clear-fns!
"Clears saved functions."
[]
(reset! fn-refs {}))
(vreset! fn-refs {}))

(defn- put-fn
"Saves a function, returning a numeric representation."
[f]
(let [n (swap! fn-index inc)]
(swap! fn-refs assoc n f)
(let [n (vswap! fn-index inc)]
(vswap! fn-refs assoc n f)
n))

(defn- get-fn
Expand Down

0 comments on commit 0f29414

Please sign in to comment.