-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why is csp.CLOSED === null? #60
Comments
You are right. The csp.CLOSED value has to be something else than null. |
Great, thanks for verifying I'm not crazy ;-). I'll submit a PR. |
csp.CLOSED === null is quite logical. null is a sentinel for communicating you have no sensible value for something. The usual somethings are variables, marking empty places in data-structures and return-values. Channels however are for communicating between some set of logical processes. What intent can you possibly mean to communicate when communicating a sentinel who's soul purpose is to signify there is nothing to say? Further, channels are not meant to be data-structures, nor are they forced to give a value (as function-calls do). Ergo:
|
What about using
You can test for strict equality:
|
Late replySorry for the long delay - life kindof happened upon me, but anyway ...
So using a single channel-result/response to represent a value or signaling closed is not something from golang; but a Clojure(Script) core.async way of doing things. In core.async (Clojure:
Using a this-attribute-does-not-exist value as a return value to signal something that does not imply mostly that seems odd to me. So if we want to keep a primitive value, I would keep it as-is: use More pragmaticSince there has been close to zero activity in this issue - and lots in of constructive talk around pull request #61, maybe the ship already sailed on this one and it is time to let go. |
FWIW pull-streams use |
Hello!
I was wondering: why is
csp.CLOSED
currently equal tonull
? Wouldn't it make more sense to assign it an arbitrary object for reference equality (or possibly a Symbol in compatible environments) so "null" can be a usable value to send through a channel? I imagine this was your intention from the beginning (otherwise there'd be little point in giving CLOSED its own property assignment in the first place), just wondering if there's a reason it isn't already in place. I believe highland uses an empty object for the same purpose (_.nil
) to allow streaming ofnull
values.The text was updated successfully, but these errors were encountered: