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
Promesa provides an implementation of clojure.core/print-method for java.util.concurrent.CompletionStage. This can lead to surprising ambiguity errors in application code (see e.g. clj-commons/manifold#237) which then must be worked around via prefer-method. Since neither the type nor the multimethod are owned by Promesa, the error doesn't give any indication as to where this ambiguity stems from which makes it tricky to track down.
Additional rationale: Since print-method only dispatches on the type of the first argument, the Guidelines for extension of protocols arguably apply here, as well. The first of these cover this particular case:
If you don’t own the protocol or the target type, you should only extend in app (not public lib) code, and expect to maybe be broken by either owner.
The text was updated successfully, but these errors were encountered:
Adding to this, not sure if this should be a separate bug report:
Promesa's print-method for CompletionStage uses the IState protocol for (pt/-pending? x) etc. However, CompletionStage does not satisfy this protocol, CompletableFuture does. As a result, printing a CompletionStage that is not a CompletableFuture will throw exceptions.
In general, Promesa's JVM implementation assumes in some places that a promise is a CompletableFuture, e.g. p/all and p/race are implemented using CompletableFuture/allOf and CompletableFuture/anyOf, expecting CompletableFuture arguments but not CompletionStage. The protocols seem to suggest that one can provide custom types that satisfy the protocols, but this will fail in seemingly random places.
Promesa provides an implementation of
clojure.core/print-method
forjava.util.concurrent.CompletionStage
. This can lead to surprising ambiguity errors in application code (see e.g. clj-commons/manifold#237) which then must be worked around viaprefer-method
. Since neither the type nor the multimethod are owned by Promesa, the error doesn't give any indication as to where this ambiguity stems from which makes it tricky to track down.Additional rationale: Since
print-method
only dispatches on the type of the first argument, the Guidelines for extension of protocols arguably apply here, as well. The first of these cover this particular case:The text was updated successfully, but these errors were encountered: