Skip to content

Some reader macros z/sexpr to different forms than read-string #305

@frenchy64

Description

@frenchy64

Version
clj -Sforce -Sdeps '{:deps {rewrite-clj/rewrite-clj {:mvn/version "1.1.47"}}}'

Platform
Operating System: macOS 14.5
Clojure version: 1.11.4
JDK vendor and version: openjdk version "21.0.1" 2023-10-17 LTS

Symptom
sexpr returns a different value than using read-string for certain reader macros.

Reproduction

clj -Sforce -Sdeps '{:deps {rewrite-clj/rewrite-clj {:mvn/version "1.1.47"}}}'
Clojure 1.11.4
user=> (require '[rewrite-clj.zip :as z])
nil
user=> (-> "~a" read-string)
(clojure.core/unquote a)
user=> (-> "~a" z/of-string z/sexpr)
(unquote a)
user=> (-> "@a" read-string)
(clojure.core/deref a)
user=> (-> "@a" z/of-string z/sexpr)
(deref a)
user=> (-> "~@a" read-string)
(clojure.core/unquote-splicing a)
user=> (-> "~@a" z/of-string z/sexpr)
(unquote-splicing a)

Actual behavior
Reader macros ~, @, ~@ expand to unquote, deref, and unquote-splicing.

Expected behavior
Reader macros ~, @, ~@ expand to clojure.core/unquote, clojure.core/deref, and clojure.core/unquote-splicing.

Diagnosis
The symbols should be updated in the source code to be qualified in clojure.core.

Action
I can submit a PR if there's interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions