Fork me on GitHub

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


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


why not 🙂


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


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?


none I was merely wondering while reading the source


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)


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