It is possible to rearrange the core.async
code so that it is compatible with self-hosted / bootstrapped ClojureScript.
Some changes needed to get things to work are in this fork: https://github.com/mfikes/andare
Below is a demo of some fundamental concepts working.
Note: The fork has been published to Clojars as "Andare," and a Quick Start on how to use it with Planck is at https://gist.github.com/mfikes/30098db2366dd25b91b2c4de0a685888
Clone the fork and then start up Planck, pointing it at the core.async
source.
$ planck -qdc core.async/src/main/clojure
cljs.user=> (require-macros '[cljs.core.async.macros :refer [go]])
nil
cljs.user=> (require '[cljs.core.async :refer [chan <! >! put! timeout]])
nil
cljs.user=> (def c (chan))
#'cljs.user/c
cljs.user=> (go (while true (let [x (<! c)] (println "c:" x))))
#object[cljs.core.async.impl.channels.ManyToManyChannel]
cljs.user=> (put! c :hello-from-self-host)
truec: :hello-from-self-host
cljs.user=> (go (while true (<! (timeout 2500)) (>! c 1)))
#object[cljs.core.async.impl.channels.ManyToManyChannel]
cljs.user=> c: 1
c: 1
c: 1
c: 1
...