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

clojure.walk/postwalk fails when given a metaconstant #267

Closed
rafaeldff opened this issue Mar 15, 2014 · 1 comment
Closed

clojure.walk/postwalk fails when given a metaconstant #267

rafaeldff opened this issue Mar 15, 2014 · 1 comment

Comments

@rafaeldff
Copy link
Collaborator

This works:

 (fact (map identity [...a... ...b...]) => [...a... ...b...])

While this fails:

user=> (require '[clojure.walk :as w])
nil

user=> (fact (w/postwalk identity [...a... ...b...]) => [...a... ...b...])

FAIL at (NO_SOURCE_FILE:1)
    Expected: [...a... ...b...]
      Actual: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IPersistentCollection
false
@marick
Copy link
Owner

marick commented May 18, 2014

This is a side effect of https://github.com/marick/Midje/wiki/Data-Prerequisites, a feature I've decided is not useful.

Because of that feature, metaconstants look like collections to Clojure. In its processing, postwalk tries to create an empty metaconstant. That (for some reason that I haven't looked into the Clojure source to find) throws the error. You get the same error from this:

(fact (prn (empty ..a..)))

… which throws the same exception.

I'm not going to fix this, because there are probably innumerable cases where metaconstants don't look quite like collections. At some point, I'll take out this (mis)feature, but not until I'm prepared to make breaking changes. (A 2.0 version)

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