You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: