Skip to content

Remove an undeclared ns cycle #240

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.4.4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this from 0.4.4 to "Unreleased changes"


* 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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -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"}
Expand All @@ -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}}
Expand Down
5 changes: 2 additions & 3 deletions src/manifold/bus.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,7 +15,7 @@

(set! *unchecked-math* true)

(definterface+ IEventBus
(definterface IEventBus
(snapshot [])
(subscribe [topic])
(downstream [topic])
Expand Down
12 changes: 6 additions & 6 deletions src/manifold/deferred.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -336,7 +336,7 @@

;;;

(definterface+ IDeferredListener
(definterface IDeferredListener
(onSuccess [x])
(onError [err]))

Expand All @@ -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])
Expand Down
8 changes: 2 additions & 6 deletions src/manifold/stream.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)))

;;;
Expand Down Expand Up @@ -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 [_]
Expand Down
15 changes: 7 additions & 8 deletions src/manifold/stream/core.clj
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
(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 [])
(downstream [])
(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 [])
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/manifold/stream/default.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/manifold/stream/queue.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{:no-doc true}
(:require
[clj-commons.primitive-math :as p]
[manifold.stream.graph :as g]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, this is a little suspicious.

It looks like it can be safely removed, but it used to be the case that some namespaces were required to force initialization of necessary data structures that were indirectly needed. Yet another reason indirect requires are a bad idea.

Removing this looks ok afaict, tho.

[manifold.deferred :as d]
[manifold.stream.core :as s]
[manifold.utils :as utils])
Expand All @@ -11,7 +10,6 @@
AtomicReference]
[java.util.concurrent
BlockingQueue
LinkedBlockingQueue
TimeUnit]))

(s/def-source BlockingQueueSource
Expand Down
6 changes: 2 additions & 4 deletions src/manifold/time.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand Down
6 changes: 0 additions & 6 deletions src/manifold/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down