squint

kuzmin_m 2024-12-11T08:21:03.677949Z

I’m trying to use for await...of, but it is not working.

clojure
(defn exec [x]
  (js/Promise.resolve x))
  
(defn ^:async ^:gen gen []
  (js-yield (exec 1))
  (js-yield (exec 2))
  nil)

(for ^:async [i (gen)] ;; It seems that squint don't support this
  (prn i))
It is what I want to get:
js
  async function exec(x) {
    return Promise.resolve(x)
  }

  async function* gen() {
    // yield await exec(1) // works too
    yield exec(1)
    yield exec(2)
  }

  for await (const i of gen()) {
    console.log(i)
  }
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of

borkdude 2024-12-11T09:23:27.867569Z

let's take a lookk

1
borkdude 2024-12-11T09:37:16.339229Z

I have to tend other stuff now but will look at the issue later

šŸ‘ŒšŸ» 1
kuzmin_m 2024-12-11T09:56:27.204509Z

https://github.com/squint-cljs/squint/issues/594

šŸ‘ 1