Comments (1)
Hey @jleonard-r7, if I understand correctly, what you're asking for here is support for round-tripping of unreadable symbols (ie those with invalid syntax, but valid runtime representations). The round-tripping pair of read
and pr
in Clojure don't really have an analogous pair in Python. Python's str
is similar to Clojure's pr-str
, but Python's repr
is something like (comp pr-str uneval)
. That is, it's the inverse of eval
, not read
. This however is especially tricky and problematic for symbols, because of evaluation rules.
I think what you're really asking for here is support for printing using the semi-secret #=
reader form. See *read-eval*
as well. In this world, some invalid symbol would be printed like: #=(symbol "namespace with spaces in it" "and/some~invalid(chars)here")
.
Note that your proposed implementation has numerous problems: consider namespaces, as well as embedded slashes or quote characters in the symbol.
I'm open to the idea of detecting unreadable symbols and fallingback to #_
. Maybe, maybe-not guarded by some :print-eval true
option. My main concern here is that analyzing a symbol for readability may meaningfully impact performance for large data printing, which is a primary usecase of Fipp.
Given how easy it is to create a new printer (basically just copy/paste/tweak edn.cljc
), I'm tempted to close this issue, but I'll leave it open in case anyone wants to attempt this and see how big the code and performance impact is.
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
- 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.