From 1ad93077c1f672ac8014f5aa2495fd1d3ba761f8 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 23 Mar 2022 23:48:09 +0100 Subject: [PATCH] fix #1216: fix core.async alts example with polyfill --- CHANGELOG.md | 4 ++++ src/babashka/impl/clojure/core/async.clj | 2 +- test/babashka/async_test.clj | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa5b0aa..a4471202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ A preview of the next release can be installed from - [#863](https://github.com/babashka/babashka/issues/863): allow pods to be declared in `bb.edn` and load them when required - See [updated pod library docs for details](TODO: link) +### Enhanced + +- [#1216](https://github.com/babashka/babashka/issues/1216): support `core.async/alts!` using polyfill + ## 0.7.8 (2022-03-13) This release improves compatibility with several libraries: [loom](https://github.com/aysylu/loom), [hugsql.core](https://www.hugsql.org) and [specter](https://github.com/redplanetlabs/specter)! diff --git a/src/babashka/impl/clojure/core/async.clj b/src/babashka/impl/clojure/core/async.clj index f6d87959..f7112f67 100644 --- a/src/babashka/impl/clojure/core/async.clj +++ b/src/babashka/impl/clojure/core/async.clj @@ -46,7 +46,6 @@ '!! (copy-var async/>!! core-async-namespace) 'admix (copy-var async/admix core-async-namespace) - 'alts! (copy-var async/alts! core-async-namespace) 'alts!! (copy-var async/alts!! core-async-namespace) 'alt!! (macrofy 'alt!! alt!! core-async-namespace) 'buffer (copy-var async/buffer core-async-namespace) @@ -107,6 +106,7 @@ '! (copy-var async/>!! core-async-namespace) 'alt! (macrofy 'alt! alt!! core-async-namespace) + 'alts! (copy-var async/alts!! core-async-namespace) 'go-loop (macrofy 'go-loop go-loop core-async-namespace)}) (def async-protocols-ns (vars/->SciNamespace 'clojure.core.async.impl.protocols nil)) diff --git a/test/babashka/async_test.clj b/test/babashka/async_test.clj index f2be1a35..7fd1050c 100644 --- a/test/babashka/async_test.clj +++ b/test/babashka/async_test.clj @@ -33,3 +33,12 @@ (is (number? (edn/read-string (test-utils/bb nil " (def ^:dynamic x 0) (binding [x 10] (async/