diff --git a/CHANGES.md b/CHANGES.md index 20f7a604..d2fbbf1e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +### 0.4.4 + +* manifold now requires Clojure 1.10 or later due to use of `requiring-resolve` + +Contributions by Allen Rohner + ### 0.4.3 * Improved clj-kondo exports @@ -71,7 +77,7 @@ Contributions by Matthew Davidson, Ryan Smith Contributions by Matthew Davidson, Ryan Smith * Add `go-off`, a `core-async`-style macro with a manifold flavor. Big thanks to Ryan Smith and Yummly for contributing this! -* Switch to `bound-fn` in `let-flow` to fix bug where dynamic vars were incorrect for other threads +* Switch to `bound-fn` in `let-flow` to fix bug where dynamic vars were incorrect for other threads * Modernized indentation to match current Clojure styles and fix misalignments ### 0.1.9 diff --git a/README.md b/README.md index 896b7d7c..a785614b 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,12 @@ Manifold can use any transducer, which are applied via `transform`. It also pro A Clojurescript implementation of Manifold can be found here: [dm3/manifold-cljs](https://github.com/dm3/manifold-cljs). +### Breaking Changes + +### 0.4.4 +- manifold now requires Clojure 1.10 or later due to use of `requiring-resolve` + + ### License Copyright © 2014-2024 Zach Tellman. diff --git a/project.clj b/project.clj index 0bd5aa52..1c5fa672 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject manifold "0.4.3" +(defproject griffinbank/manifold "0.4.4-20250811" :description "A compatibility layer for event-driven abstractions" :license {:name "MIT License" :url "http://opensource.org/licenses/MIT"} @@ -10,7 +10,7 @@ [org.clj-commons/primitive-math "1.0.0"] [riddley "0.2.0"] [org.clojure/core.async "1.6.673" :scope "provided"] - [potemkin "0.4.6"]] + [griffinbank/potemkin "0.4.9-20250811"]] :profiles {:dev {:dependencies [[criterium "0.4.6"]] :global-vars {*warn-on-reflection* true *unchecked-math* :warn-on-boxed}} diff --git a/src/manifold/bus.clj b/src/manifold/bus.clj index edd8efba..21fec30b 100644 --- a/src/manifold/bus.clj +++ b/src/manifold/bus.clj @@ -4,8 +4,7 @@ (:require [manifold [stream :as s] - [deferred :as d] - [utils :refer [definterface+]]] + [deferred :as d]] [potemkin.types :refer [deftype+]] [clj-commons.primitive-math :as p]) (:import @@ -16,7 +15,7 @@ (set! *unchecked-math* true) -(definterface+ IEventBus +(definterface IEventBus (snapshot []) (subscribe [topic]) (downstream [topic]) diff --git a/src/manifold/deferred.clj b/src/manifold/deferred.clj index 18efe072..d8e5242e 100644 --- a/src/manifold/deferred.clj +++ b/src/manifold/deferred.clj @@ -8,8 +8,8 @@ [manifold.debug :as debug] [manifold.executor :as ex] [manifold.time :as time] - [manifold.utils :as utils :refer [assert-some definterface+]] - [potemkin.types :refer [def-abstract-type reify+ defprotocol+ deftype+]] + [manifold.utils :as utils :refer [assert-some]] + [potemkin.types :refer [def-abstract-type reify+ deftype+]] [clj-commons.primitive-math :as p] [riddley.compiler :as compiler] [riddley.walk :as walk]) @@ -44,11 +44,11 @@ (set! *warn-on-reflection* true) (set! *unchecked-math* true) -(defprotocol+ Deferrable +(defprotocol Deferrable (^:private to-deferred [_] "Provides a conversion mechanism to manifold deferreds.")) ;; implies IDeref, IBlockingDeref, IPending -(definterface+ IDeferred +(definterface IDeferred (executor []) (^boolean realized []) (onRealized [on-success on-error]) @@ -336,7 +336,7 @@ ;;; -(definterface+ IDeferredListener +(definterface IDeferredListener (onSuccess [x]) (onError [err])) @@ -354,7 +354,7 @@ ([on-success on-error] (Listener. on-success on-error))) -(definterface+ IMutableDeferred +(definterface IMutableDeferred (success [x]) (success [x claim-token]) (error [x]) diff --git a/src/manifold/stream.clj b/src/manifold/stream.clj index 3a3d0978..5d54de4a 100644 --- a/src/manifold/stream.clj +++ b/src/manifold/stream.clj @@ -297,10 +297,6 @@ ([^IEventSource source default-val ^double timeout timeout-val] (.take source default-val false timeout timeout-val))) -;;; - -(require '[manifold.stream.graph]) - (defn connect "Connects a source to a sink, propagating all messages from the former into the latter. @@ -331,7 +327,7 @@ connector (.connector ^IEventSource source sink)] (if connector (connector source sink options) - (manifold.stream.graph/connect source sink options)) + ((requiring-resolve 'manifold.stream.graph/connect) source sink options)) nil))) ;;; @@ -866,7 +862,7 @@ (isSynchronous [_] false) (downstream [this] - (manifold.stream.graph/downstream this)) + ((requiring-resolve 'manifold.stream.graph/downstream) this)) (close [_] (.close ^IEventStream buf)) (description [_] diff --git a/src/manifold/stream/core.clj b/src/manifold/stream/core.clj index a5d0fbc9..1d90f78b 100644 --- a/src/manifold/stream/core.clj +++ b/src/manifold/stream/core.clj @@ -1,15 +1,14 @@ (ns manifold.stream.core {:no-doc true} - (:require [manifold.utils :refer [definterface+]] - [potemkin.types :refer [deftype+ defprotocol+]])) + (:require [potemkin.types :refer [deftype+]])) -(defprotocol+ Sinkable +(defprotocol Sinkable (to-sink [_] "Provides a conversion mechanism to Manifold sinks.")) -(defprotocol+ Sourceable +(defprotocol Sourceable (to-source [_] "Provides a conversion mechanism to Manifold source.")) -(definterface+ IEventStream +(definterface IEventStream (description []) ; Is the underlying class synchronous by default? NB: async usage is still possible, but requires wrapping (isSynchronous []) @@ -17,14 +16,14 @@ (weakHandle [reference-queue]) (close [])) -(definterface+ IEventSink +(definterface IEventSink (put [x blocking?]) (put [x blocking? timeout timeout-val]) (markClosed []) (isClosed []) (onClosed [callback])) -(definterface+ IEventSource +(definterface IEventSource (take [default-val blocking?]) (take [default-val blocking? timeout timeout-val]) (markDrained []) @@ -86,7 +85,7 @@ (alterMeta [_ f# args#] (manifold.utils/with-lock* ~'lock (set! ~'__mta (apply f# ~'__mta args#)))) - (~'downstream [this#] (manifold.stream.graph/downstream this#)) + (~'downstream [this#] ((requiring-resolve 'manifold.stream.graph/downstream) this#)) (~'weakHandle [this# ref-queue#] (manifold.utils/with-lock ~'lock (or ~'__weakHandle diff --git a/src/manifold/stream/default.clj b/src/manifold/stream/default.clj index d5d08f06..ee5a6823 100644 --- a/src/manifold/stream/default.clj +++ b/src/manifold/stream/default.clj @@ -10,7 +10,7 @@ [graph :as g] [core :as s]] [manifold.time :as time] - [potemkin.types :refer [deftype+ defrecord+]] + [potemkin.types :refer [deftype+]] [clj-commons.primitive-math :as p]) (:import [java.util @@ -35,8 +35,8 @@ (deftype+ Production [deferred message token]) (deftype+ Consumption [message deferred token]) -(defrecord+ Producer [message deferred]) -(defrecord+ Consumer [deferred default-val]) +(defrecord Producer [message deferred]) +(defrecord Consumer [deferred default-val]) (defn de-nil [x] (if (nil? x) diff --git a/src/manifold/stream/queue.clj b/src/manifold/stream/queue.clj index 15a307cf..c8fa3d7f 100644 --- a/src/manifold/stream/queue.clj +++ b/src/manifold/stream/queue.clj @@ -2,7 +2,6 @@ {:no-doc true} (:require [clj-commons.primitive-math :as p] - [manifold.stream.graph :as g] [manifold.deferred :as d] [manifold.stream.core :as s] [manifold.utils :as utils]) @@ -11,7 +10,6 @@ AtomicReference] [java.util.concurrent BlockingQueue - LinkedBlockingQueue TimeUnit])) (s/def-source BlockingQueueSource diff --git a/src/manifold/time.clj b/src/manifold/time.clj index f1315b47..1f5da644 100644 --- a/src/manifold/time.clj +++ b/src/manifold/time.clj @@ -5,8 +5,6 @@ [clojure.tools.logging :as log] [manifold.executor :as ex] [clojure.string :as str] - [manifold.utils :refer [definterface+]] - [potemkin.types :refer [defprotocol+]] [clj-commons.primitive-math :as p]) (:import [java.util @@ -130,11 +128,11 @@ ;;; -(definterface+ IClock +(definterface IClock (in [^double interval-millis ^Runnable f]) (every [^double delay-millis ^double period-millis ^Runnable f])) -(defprotocol+ IMockClock +(defprotocol IMockClock (now [clock] "Returns the current time for the clock") (advance [clock time] "Advances the mock clock by the specified interval of `time`. diff --git a/src/manifold/utils.clj b/src/manifold/utils.clj index 0d19f438..3e433374 100644 --- a/src/manifold/utils.clj +++ b/src/manifold/utils.clj @@ -131,12 +131,6 @@ ;;; -(defmacro definterface+ [name & body] - (when-not (resolve name) - `(definterface ~name ~@body))) - -;;; - (defn fn->Function [f] (reify java.util.function.Function (apply [_ x] (f x))))