Transforms async function bodies with await into Promise .then chains.
Supports await in:
Example: (defn ^:async foo [] (let [x (await (js/Promise.resolve 1))] (inc x)))
Transforms to: (defn foo [] (.then (js/Promise.resolve 1) (fn [x] (inc x))))
Transforms async function bodies with await into Promise .then chains.
Supports await in:
- let bindings: (let [x (await p)] ...)
- do forms: (do (await p) ...)
- arbitrary expressions: (inc (await p))
- macros like -> are expanded first
Example:
(defn ^:async foo []
(let [x (await (js/Promise.resolve 1))]
(inc x)))
Transforms to:
(defn foo []
(.then (js/Promise.resolve 1) (fn [x] (inc x))))The execution-local state shared by world selection and dynamic bindings.
The execution-local state shared by world selection and dynamic bindings.
Self-describing mutable references whose state is relative to an SCI world.
Self-describing mutable references whose state is relative to an SCI world.
Dense, fork-local runtime state for SCI contexts.
Stable handles are assigned integer slots once per context lineage. A world stores slot values densely; a fork copies that array. Mutable primitives CAS only their own slot, so unrelated atoms never contend on a shared world root.
Locking (JVM). Evaluation takes no world lock and reads slots lock-free.
slot-gate (read): every slot write, together with the host-object
mirror of a primary world (Var root/meta, Namespace meta, Type data,
volatile) and a lazy realization step. No user code runs inside.publish-gate (read): a publication of several slot writes that must
appear together, e.g. a def's value and metadata. No user code runs
inside: Var watch notifications are deferred until it ends, and the
namespace-environment atom (whose watches and validator are user code)
is never updated inside.slot-gate exclusively for the array copy.
A fork is therefore a cut between individual publications. Every
publication makes its result reachable last: slots are written before an
environment mapping or slot value refers to the handle.Dense, fork-local runtime state for SCI contexts. Stable handles are assigned integer slots once per context lineage. A world stores slot values densely; a fork copies that array. Mutable primitives CAS only their own slot, so unrelated atoms never contend on a shared world root. Locking (JVM). Evaluation takes no world lock and reads slots lock-free. - `slot-gate` (read): every slot write, together with the host-object mirror of a primary world (Var root/meta, Namespace meta, Type data, volatile) and a lazy realization step. No user code runs inside. - `publish-gate` (read): a publication of several slot writes that must appear together, e.g. a def's value and metadata. No user code runs inside: Var watch notifications are deferred until it ends, and the namespace-environment atom (whose watches and validator are user code) is never updated inside. - A fork takes both write locks only for the copy: primary realization, the cells, the lazy realization caches and the namespace environment. It excludes writers for that copy and never waits for an evaluation. - A resize takes `slot-gate` exclusively for the array copy. A fork is therefore a cut between individual publications. Every publication makes its result reachable last: slots are written before an environment mapping or slot value refers to the handle.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |