You could do both:

Make the channel optional. If it's provided, use that and return it. If
it's not provided, create a new one and use and return that.

This way the caller gets to decide which they wish to use based on who the
owner of the channel should be or if the channel should be reused elsewhere.

For example, for a once-off call, creating s new channel may make more
sense but if the function is called frequently it might make more sense to
reuse one channel, especially if this channel is used with other plumbing
like pub/sub or mult which you would otherwise need to set up every time.

On Mon, 10 Nov 2014 17:42 Mike Haney <txmikes...@gmail.com> wrote:

> Eric Normand has an interesting article on this here:
> http://www.lispcast.com/core-async-code-style
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to