Clojure

Details

Type:
Enhancement

Status:
Closed

Priority:
Minor

Resolution:
Declined

Affects Version/s:
None

Fix Version/s:
None

Component/s:
None

Labels:

None

Description

I'd like a predicate to determine whether an object is a (promise). Currently promises are implemented as a reify of IFn and IDeref, meaning there is no meaningful superclass to test for. It seems to me the simplest solution would be to create an IPromise interface extending IDeref; then (defn promise? [x] (instance? IPromise x)) is a simple solution. Even an empty "tagging" interface for IPromise would do, but it might also be nice to add a delivered? predicate for promises so that it's possible to test whether they're delivered without blocking or catching the "multiple deliver" exception; that would make the IPromise interface more meaningful as well.

This is fairly simple stuff, so I'll start plugging away at a patch and hope nobody objects.