Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with clojure.walk and metaconstants #397

Open
ayrtonsin opened this issue Jul 11, 2017 · 1 comment
Open

Problem with clojure.walk and metaconstants #397

ayrtonsin opened this issue Jul 11, 2017 · 1 comment

Comments

@ayrtonsin
Copy link

see following case

(defn simple-walk "does nothing" 
  [m]  
  (clojure.walk/postwalk 
    (fn [x] x) 
    m))

(facts "about `simple-walk`"
  (fact "with simple map,  returns the map"
        (simple-walk {:this "works"}) => {:this "works"})
  (fact "simple map with metaconstant throws java.lang.ClassCastException"
      (simple-walk {:a ..something..}) => (throws java.lang.ClassCastException)))

the exception: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IPersistentCollection

@philomates
Copy link
Collaborator

philomates commented Jul 11, 2017

Hey @ayrtonsin, thanks for reporting this.
It looks like a duplicate of #267, which we closed on accident (it hasn't been resolved yet).

I described the underlying issue here:

the postwalk example still doesn't run because the postwalk will do a (into (empty ..a..) (map identity ..a..)) which will reduce to (conj {} ..a..) and subsequently {} due to ambiguous semantics of merging a partially-defined map (metaconstant) with a concrete map

I'm not really sure how to fix this yet, so it might be a while before it gets resolved, but I think it is worth thinking about more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants