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

extend Object in clj #783

Closed
lilactown opened this issue Jul 25, 2022 · 0 comments
Closed

extend Object in clj #783

lilactown opened this issue Jul 25, 2022 · 0 comments

Comments

@lilactown
Copy link
Contributor

lilactown commented Jul 25, 2022

version

0.3.32 and master

platform

macOS / Clojure 1.11.1

problem

satisfies? in SCI does not properly discern between extending Object and the protocol not being implemented for the type.

repro

(defprotocol IFoo (foo [_]))
(extend-type Object IFoo (foo [_] :default))
(map #(vector (satisfies? IFoo %) (foo %)) [(Object.) "" 1 (make-array Long 3) inc true])

expected behavior

The above code should return the following:

([true :default] [true :default] [true :default] [true :default] [true :default] [true :default])

actual behavior

When run via bb, it returns the following:

([false :default] [false :default] [false :default] [false :default] [false :default] [false :default])
lilactown added a commit to lilactown/sci that referenced this issue Jul 25, 2022
simplifies the code when extending the protocol impls, and also fixes the
problem with extending to Object in clojure not returning true for satisfies?
borkdude pushed a commit that referenced this issue Jul 27, 2022
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

No branches or pull requests

2 participants