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

Can't encode SubVector #12

Open
catharinejm opened this issue Jun 5, 2015 · 1 comment
Open

Can't encode SubVector #12

catharinejm opened this issue Jun 5, 2015 · 1 comment

Comments

@catharinejm
Copy link

repl=> (clj->cljson (subvec [1 2 3 4] 0 2))
IllegalArgumentException No cljson encoding for '[1 2]'.  tailrecursion.cljson/encode (cljson.clj:72)

Looks like clojure.lang.PersistentVector is extended with EncodeTagged, but not clojure.lang.IPersistentVector. In my (extremely rudimentary) testing, making it IPersistentVector instead seems to work fine.

@alandipert
Copy link
Member

Good catch!

Trolling around clojure.lang.RT and clojure.lang.APersistentVector$SubVector, it looks like what we want is to add an implementation for instances of clojure.lang.APersistentVector, or possibly check for APersistentVector instead of PersistentVector.

Using IPersistentVector works, but we want to avoid interfaces if we can because they might overlap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants