Closed borkdude closed 2 years ago
@grzm I pushed something to printwithwriter
(not ready).
If we can get SCI to put (-pr-writer ..)
functions as metadata on the record var under :sci.impl/print-method
then it should work.
So we should add some hard-coded check of IPrintWithWriter
implementations and then handle that separately.
Similar to
print-method
.Some notes:
1) SCI implements protocols methods as multimethods 2) In JVM
print-method
is not included by default, it needs access to the hostprint-method
multimethod 3) SCI records are based on one Clojure / CLJS record type which defers to a runtime SCI type. When implementingprint-method
for a SCI records, some state is mutated which affects the general Clojure / CLJSprint-method
for the general record type which dispatches on the SCI type. 4) To let users implementIPrintWithWriter
in general (not records), we could do two things:IDeref
in SCI). This comes with performance overhead for printing though.Also see https://github.com/babashka/sci/issues/639
It seems, just for SCI records, we don't need to implement IPrintWithWriter for all use cases, so maybe starting with 5 and working our way back is the best approach.