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

Support clojure.pprint/simple-dispatch on records #740

Closed
frenchy64 opened this issue May 18, 2022 · 0 comments
Closed

Support clojure.pprint/simple-dispatch on records #740

frenchy64 opened this issue May 18, 2022 · 0 comments

Comments

@frenchy64
Copy link

frenchy64 commented May 18, 2022

Is your feature request related to a problem? Please describe.
Supporting plumatic schema in babashka

This improves how schemas are pretty printed.

Describe the solution you'd like
Support in sci for simple-dispatch in the same way as print-method.

Describe alternatives you've considered
Leaving as-is.

Desired behavior

clj                                                                                                                               ✘ INT 40s
Clojure 1.11.1
user=> (defrecord Foo [])
user.Foo
user=> (require '[clojure.pprint :as pp])
nil
user=> (defmethod pp/simple-dispatch Foo [_] (pp/write-out "PRETTY"))
#object[clojure.lang.MultiFn 0x6075b2d3 "clojure.lang.MultiFn@6075b2d3"]
user=> (pp/pprint (Foo.))
"PRETTY"
nil

Actual behavior

./bb
Babashka v0.8.3-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (defrecord Foo [])
#'user/Foo
user=> (require '[clojure.pprint :as pp])
nil
user=> (defmethod pp/simple-dispatch Foo [_] (pp/write-out "PRETTY"))
#object[clojure.lang.MultiFn 0x68c9cd26 "clojure.lang.MultiFn@68c9cd26"]
user=> (pp/pprint (Foo.))
{}
nil
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

1 participant