Fork me on GitHub
#core-async
<
2020-01-29
>
mpenet16:01:38

Would it be ok to patch async/thread to return an async/promise-chan instead of a (chan 1) ?

mpenet16:01:10

arguably that would change behavior slightly when taking since currently it produces only a single message

mpenet16:01:03

why not 🙂

mpenet16:01:15

for one I think that might be slightly more efficient/lightweight

mpenet16:01:44

I suspect if it was written today it might be using promise-chan, don't you think?

Alex Miller (Clojure team)16:01:50

what problem are you trying to solve?

mpenet16:01:46

none I was merely wondering while reading the source

yonatanel19:01:02

There might be a slight difference in behavior somewhere since if thread returns nil the channel just closes, but a promise-chan with nil val has a count of 1 (just from reading the source, not sure about the implications)

hiredman19:01:24

If you where making a change there (which meh) a promise-chan still isn't the best thing to return, because a promise-chan is still both a read port and a write port, and I think the best thing for go blocks to return is something that is just a read port. But I do think there are arguments to be made for the uniformity of just channels without the read/write port splitting