-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Records can't be serialised and deserialised by Conjure #40
Comments
Patch released in |
Error improvement work is now waiting for this patch to go into ClojureScript https://clojure.atlassian.net/browse/CLJS-3096 Once that's in I can rewrite how the error handling system works which means I don't need to parse output from prepl evaluations which means this error will vanish. This will make Conjure a lot more robust too, right now there's a few cases where returning something out of the ordinary will cause it to choke. If you hit one of these errors, I'm really sorry. You'll just have to pour the data into Clojure data structures or use bean until this is patched, hopefully it won't be too long! |
I think I'm running into this with Manifold streams. They have a custom print-method that returns this:
and causes Conjure to report "Invalid symbol: stream:.". No rush, just wanted to add another data point. Thanks for making Conjure, I enjoy using it every day. |
Ah damn, I'm sorry about that 😭 try pouring it into a map or bean, it might get around the printing temporarily. I'm still waiting on my patch going into ClojureScript, maybe I can do a halfway house soon to fix the Clojure side at least. Once that CLJS patch is in I won't have to parse anything returned from the prepl which will make things a lot easier. I'll see what I can do to mitigate it until the proper fixes are possible 🤔 |
I'm also being hit by this in a project I'm working on. I did find a workaround: if you find yourself needing to evaluate a form where you know the result is a record, you can wrap it with There is still a problem if you want to evaluate a form that contains records (e.g. a map where the values include records). I found a solution for this on StackOverflow: It's not ideal, but I think it will tide me over until a fix comes down the pike :) |
I've got an idea for how I could potentially work around this until ClojureScript prepl hits feature parity with Clojure prepl 🤔 I'll see what I can do ASAP, just got talk planning to do for next Wednesday. |
Testing Slack integration... |
@daveyarwood great idea to use clojure.walk. Here's my augmented version that handles manifold streams:
|
So when someone who's experienced this has some free time, would you be able to try it again but on the I'll try to repro too, but it would be great if you could try to do exactly what you did before that caused Conjure to explode. I'm hoping my changes have fixed it, if not I think a slight tweak will be all that's needed after that refactor work. Thanks a lot! |
A simple repro case is to evaluate the following using your project's prepl: ;; this works because the return value is the var `my-namespace.Foo`
(defrecord Foo [])
;; this blows up because the return value is a record
(->Foo) |
Yessss, thank you for checking, that's great news. I'll wrap up the rest of that PR and get it out in a tagged release. |
The issue is fixed for me as well. Thanks! |
So this is fixed in |
mynomoto
over on Slack pointed out that if you try to return a record from an eval Conjure explodes.Because that evaluates to the string
#conjure.code.Foo{:bar \"bar\"}
Which Conjure tries to read because it reads all prepl responses (for better or worse...). I think the main need to read responses is because I want to check if it was an error or not. That will go away when I overhaul how errors and exceptions work.
Would be cool to fix this ASAP, but if you hit this before then just
(into {} r)
wherer
is your record. It'll get around this issue until I can patch it out or it vanishes on it's own when I improve errors.The text was updated successfully, but these errors were encountered: