Skip to content
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

pulsar/promise doesn't mimic clojure.core/promise #35

Closed
dehubbed opened this issue Feb 13, 2015 · 1 comment
Closed

pulsar/promise doesn't mimic clojure.core/promise #35

dehubbed opened this issue Feb 13, 2015 · 1 comment
Assignees
Labels

Comments

@dehubbed
Copy link

Pulsar's promises are different from clojure.core's promises:

clojure.core's promises can be delivered to multiple times. so you can e.g. create a promise once (def p (promise)) and repeatedly call e.g. (deliver p 42). only the first call will set the value to 42, subsequent calls with the same or different value have no effect whereas pulsar's promises throw an exception. however on clojure.core the return value is different. the first call to deliver will return the promise itself, the same way pulsar's promises do. subsequent calls return nil.

I don't know whether pulsar's promises are supposed to be an exact drop-in replacement for clojure.core's promises, but if they are to be, then there might be code out there that relies on the above behavior that needs to be respected.

I know my code relies on the multiple-delivery ability. it sort of makes 'deliver' idempotent, an important quality in functional programming. the different return values are not only not significant to me but seem to counter immutability principles, however there might be code out there that relies on them.

@pron pron added the bug label Feb 13, 2015
@pron
Copy link
Contributor

pron commented Feb 13, 2015

You are correct. As pulsar's promises should be drop-in replacements, subsequent calls to deliver should return nil (and have no effect), rather than throw an exception.

This will be fixed in the upcoming release.

@circlespainter circlespainter self-assigned this Feb 14, 2015
circlespainter pushed a commit that referenced this issue Feb 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants