Fork me on GitHub
#clojurescript
<
2022-04-14
>
bteuber08:04:07

Hi! On NodeJS I'm trying to read and process huge backup files one S-Exp at the time without getting out of memory. So I guess I have to somehow implement IPushbackReader on Readable streams. Did somebody ever do something similar by chance?

dgb2309:04:29

Not sure if this helps, but JS has array buffers, which you can use to explicitly allocate and avoid GC. As always the best documentation is on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer

bteuber09:04:27

Thx. I'll try to use it somehow

bteuber11:04:30

Ah, great - I didn't see this

pinkfrog10:04:52

I have an async function in js, which is called with await foo(). How can I call foo in cljs?

p-himik10:04:29

(let [promise (foo)]
  (.then promise (fn [result] ...)))

Sakib10:04:12

Can I write HTML without any library like reagent in clojurescript?

Nazral13:04:57

I need to synchroneously wait for the result of a go block (due to a cljs-http call), is there a way to do that ?

p-himik14:04:16

You gotta restructure your code so it supports async stuff.

Sam Ritchie17:04:01

Huh, is there really no blocking get in core.async?

p-himik18:04:35

There is no blocking in CLJS, because there's no blocking in JS.

Sam Ritchie18:04:04

I would have expected it semantically to mean “don't move on until this form is done”

p-himik18:04:04

Well, you can fire off some code as a reaction to a result of a go block. Only that result->reaction part will be synchronous. But the whole app will be async - there will be other code running. That's why you can't just pass a result of a go block into a function - you have to restructure your code in such a way so that it works correctly in an inherently async environment.

Nazral06:04:29

thanks for the help!