[ASYNC-74] Provide a chan? function to determine if a given var is a channel Created: 23/Jun/14 Updated: 30/Jun/14
When using channels, for example for streaming http bodies, it would be really helpful if there would be a chan? function to check whether a given var is a channel or not.
Aleph already does it like that in it's http-server/client implementation using lamina channels and it feels quite consistent.
It would of course also be more consistent with the rest of clojure to provide a type checking function for basic objects.
|Comment by David Rupp [ 30/Jun/14 9:58 AM ]|
Implement chan? predicate.
|Comment by Timothy Baldridge [ 30/Jun/14 10:50 AM ]|
I'm in favor of this, but last time I asked Rich about it his quote was "do you want a predicate for every single interface?".
Due to the implementation of core.async you'd probably need two additional predicates. One for read-port? and write-port?. You can use (satisfies? clojure.core.async.impl.protocols/ReadPort ...) but that's an internal implementation, so I'd rather have a new predicate than to tell people to touch the innards of core.async. But this call is up to Rich.
|Comment by Reno Reckling [ 30/Jun/14 11:07 AM ]|
I understand that reasoning. But then we would have to step up on documentation and provide a way to easily determine which interfaces are implemented by the return values of for example (chan). For me, going into the innards of core.async and trying to determine which interfaces I want, especially on very basic things like a channel, is not a user friendly approach at all.