Comments (5)
wip: https://github.com/brandonbloom/fipp/tree/control
from fipp.
This is useful to prevent the printer from going in to an infinite loop, but cyclic structures are pretty rare for pretty-printed EDN data and recursive (and potentially cyclic) printing is pretty rare for standard JVM toString implementations. I'd entertain a patch for this if were a trivially small perf impact, but I suspect that naive usage of a set won't be fast enough due to deep equality comparisons. Maybe if we could use a visited-check that does object-identity only, it would be fast enough, but then we may exceed the complexity/effort budget for this feature.
from fipp.
Even just doing a visited-check would cause problems with seq head retention I think. Unless there's some really clever way of doing this that isn't obvious to me, we can't avoid keeping a reference to the entire coll currently being printed, which might be an infinite lazy sequence.
from fipp.
Laziness is interesting here, but there's a simpler problem to consider: Cycles in strict data structures, which can only happy with mutation, eg:
(def a (atom nil))
(do (reset! a a) nil)
(fipp.edn/pprint a)
In this case, the root node is, presumably, already going to be retained unless the only thing you want to do is to print the tree out and discard it. So I think there's no real problem there.
Infinite data structures are already addressed by print-length, so I don't think I care about intra-seq cycles. or anything like that.
The interesting case is lazy seqs, but I'm not even sure I care if they are retained when cycle detection is enabled. As long as it's opt in, it should be fine.
from fipp.
Closing as I've never actually wanted this in years of using Fipp. If somebody comes along and provides a robust, tested patch for opting-in to cycle detection that doesn't have much overhead, I'd probably accept it.
from fipp.
Related Issues (20)
- Optional println? HOT 1
- Make usage of commas optional HOT 3
- :pass rendered before indentation HOT 4
- clojurescript tests failing HOT 2
- consider automating tests on circleci HOT 3
- print-table of nested map HOT 1
- Use of undeclared Var clojure.core.rrb-vector.rrbt/Transient HOT 3
- java.sql.Timestamp not guaranteed to exist HOT 9
- BigDecimal Handling HOT 10
- Escaping of newlines in strings HOT 2
- Incompatible with Java 11 due to org.clojure/core.rrb-vector dependency HOT 1
- a strange case in generating regex with slashes, related to ClojureScript HOT 5
- print unreadable symbol utilizing #=(symbol ...) for *read-eval* HOT 1
- Babashka compatibility HOT 19
- How to specify fixed width floats in specific tagged-literals for output purposes HOT 2
- ClojureScript: fipp interacts badly with console.log as default print strategy HOT 6
- UnsupportedOperationException when printing java.sql.Date HOT 2
- Optionally print without trailing comma HOT 1
- `fipp.ednize/override?` uses `satisfies?` HOT 5
- Printing a Var macro ad verbum may render an unreadable EDN file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fipp.