Allow fipp to operate independently of core print options #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In some tooling contexts it is undesirable to read or rebind dynamic vars like
*out*
. For example, during theprint
phase of an evaluation at the REPL, using*out*
can result in debug output being intermingled with the printed output.This is also undesirable:
This PR adds a
:writer
option (defaults to*out*
) and alterspprint-document
to write its output directly to the writer rather than using the machinery ofprint
.println
is still called at the end to preserve the existing behaviour wrt*flush-on-newline*
. N.B. this change seems to have a positive effect on the:long
benchmark – from 126ms to 83ms on my machine.For CLJS the equivalent option is
:print-fn
(defaults to*print-fn*
), which I have added in a separate commit.*out*
isn't generally set to anything in CLJS so I think this is the more logical extension point.I also found that because of the use of
pr-str
infipp.edn
, it was possible to print invalid EDN depending on the values of*print-dup*
/*print-readably*
:Changes in
fipp.edn
to ensure we always print valid EDN:visit-string
andvisit-character
, bind*print-readably*
to true when callingpr-str
.visit-number
, just usestr
, since that's whatprint-method
does (print-dup
adds the ctor).visit-pattern
, just usestr
, sincetag
is always a symbol.Additionally, add the
[javax.xml.bind/jaxb-api "2.3.1"]
dev-time dependency, so the CLJS tests can run on JDK11. We could also bump the CLJS version to 1.10.63 or later.