brandonbloom / fipp

Fast Idiomatic Pretty Printer for Clojure
525 stars 44 forks source link

Distinguish `~(deref a)` from `~@a`, don't unexpand reader macros if lossy #90

Open frenchy64 opened 1 month ago

frenchy64 commented 1 month ago

There are several problems unexpanding reader macros, sometimes yielding pretty-printings that don't round-trip.

  1. ~(deref foo) and ~ @foo are being printed as ~@foo.
  2. reader macros are being unexpanded even with the wrong number of arguments
    • (var) => (var nil)
    • (var 1 2 3) => (var 1)
  3. The op of a reader expansion is not being checked thoroughly enough.
    • (let [deref a] (deref a)) => (let [deref a] @a)

I try and fix all these issues in this PR.