Skip to content
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

respect java.lang.AutoCloseable #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

loganlinn
Copy link

@loganlinn loganlinn commented Feb 25, 2022

the README suggests AutoCloseable is respected, but currently is not.

reproduction:

dev=> (require '[juxt.clip.core :as clip])
nil

dev=> (def config
 #_=>   {:components
 #_=>    {:a {:start #(reify java.lang.AutoCloseable
 #_=>                   (close [_]
 #_=>                     (println "close <java.lang.AutoCloseable>")))}
 #_=>     :b {:start #(reify java.io.Closeable
 #_=>                   (close [_]
 #_=>                     (println "close <java.io.Closeable>")))}}})
 #_=>

dev=> (clip/stop config (clip/start config))
close <java.io.Closeable>
{:a nil, :b nil}

makes the following improvements:

  • switch java.io.Closeable to superinterface, java.lang.AutoCloseable.
  • switch from (isa? (class x) C) to more idiomatic (instance? C x).

the README suggests `AutoCloseable` is respected, but currently is not.

reproduction:
```
dev=> (require '[juxt.clip.core :as clip])
nil

dev=> (def config
 #_=>   {:components
 #_=>    {:a {:start #(reify java.lang.AutoCloseable
 #_=>                   (close [_]
 #_=>                     (println "close <java.lang.AutoCloseable>")))}
 #_=>     :b {:start #(reify java.io.Closeable
 #_=>                   (close [_]
 #_=>                     (println "close <java.io.Closeable>")))}}})
 #_=>

dev=> (clip/stop config (clip/start config))
close <java.io.Closeable>
{:a nil, :b nil}
```

makes the following improvements:
- switch `java.io.Closeable` to superinterface, `java.lang.AutoCloseable`.
- switch from `(isa? (class x) C)` to idiomatic `(instance? C x)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant