Fork me on GitHub
#core-async
<
2018-11-01
>
Logan Powell17:11:03

👋 I'm all over the place today... Is it possible to deref a promise-chan in CLJS? I can't find any docs on dereferencing channels anywhere... The only place I've heard about it is in Rich Hickey's "Inside Transducers" talk, but I'm starving for docs... I have a use case wherein such semantics would be well suited

noisesmith17:11:43

a promise chan can be read like any other channel

noisesmith17:11:07

after it has been written to, it will repeatedly give that value every time it is read

Logan Powell17:11:12

In Rich's talk he said that they can also have deref'able semantics?

hiredman17:11:21

not in cljs

hiredman17:11:40

deref would have to potentially block

Logan Powell17:11:52

that's what I wanted to do 😄

Logan Powell17:11:05

I was hoping there was a "parking" deref or something

noisesmith17:11:20

why not use a parking channel read?

Logan Powell17:11:23

but something that didn't require I wrap everything in a go block

noisesmith17:11:42

then use take! with a callback arg?

Logan Powell17:11:50

basically, I'm being lazy in making something local remote and refactoring it to be async

Logan Powell17:11:02

that's probably the best way

Logan Powell17:11:11

I'll give that a go

Logan Powell17:11:41

the semantics/contract is just going to be way different

Logan Powell17:11:12

what used to be a value (subordinate) is going to end up being a superordinate

Logan Powell18:11:07

I tried to use an atom and reset! it asynchronously, which worked with those nice semantics not having to change, but it required the function to be called twice to "hydrate" the atom

hiredman18:11:48

I think that is maybe the big problem

hiredman18:11:11

the values in an atom should be complete

hiredman18:11:09

the model for atoms is atomic succession of states, so if you stick in a state that is not complete, then later stick in the completed state, you are departing from that model