Giter VIP home page Giter VIP logo

Comments (1)

brandonbloom avatar brandonbloom commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.