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

WARNING: No such namespace: clojure.lang.PersistentHashMap #67

Closed
jwr opened this issue Sep 4, 2015 · 4 comments
Closed

WARNING: No such namespace: clojure.lang.PersistentHashMap #67

jwr opened this issue Sep 4, 2015 · 4 comments

Comments

@jwr
Copy link

jwr commented Sep 4, 2015

This isn't really a bug report, because I am still not certain where the bug actually is. I'm hoping you will either have an idea, or perhaps some pointers.

I've spent the better part of the last days trying to figure out why I'm getting warnings like:

WARNING: No such namespace: clojure.lang.PersistentHashMap, could not locate clojure/lang/PersistentHashMap.cljs, clojure/lang/PersistentHashMap.cljc, or Closure namespace "" at line 147

I get these warnings only in a certain environment: when compiling using figwheel, but not when launching via lein figwheel, but starting figwheel directly from the application, as the chestnut template does.

I managed to narrow it down to:

(rum/defc test-component-1 [params]
  (let [{:keys [a b]} params]
    ;; The above line causes a 'WARNING: No such namespace: clojure.lang.PersistentHashMap, could not locate
    ;; clojure/lang/PersistentHashMap.cljs, clojure/lang/PersistentHashMap.cljc, or Closure namespace ""' to be
    ;; generated, with line number pointing to the line with the defc declaration.
    [a b]))

(rum/defc test-component-2 [params]
  (let [a (:a params) ;; This component does not generate any warnings.
        b (:b params)]
    [a b]))

In other words, if a component does map destructuring inside a let form, the warnings appear.

I checked and Rum doesn't really do much with the body, passing it to sablono's compile-html.

Do you have any idea what could be causing these warnings?

@tonsky
Copy link
Contributor

tonsky commented Sep 7, 2015

Got the same problem today (rum/cljs 1.7.122/sablono 0.3.6). It worked fine in cljs file, but once I renamed it to cljc, it broke. Just a destructuring in top-level form:

(rum/defc checkboxes-response [item opts]
  (let [{id :entry/id
         {choices :choices
          max     :max-selection} :item/attrs} item

@r0man
Copy link
Owner

r0man commented Sep 11, 2015

Hey, I'm on a surf trip in Spain and AFK for the foreseeable future. If
someone of you can come up with a fix I will merge it. Not sure what the
problem is. Does it even make sense to have React code in a cljc file?
On 7 Sep 2015 2:38 pm, "Nikita Prokopov" notifications@github.com wrote:

Got the same problem today (rum/cljs 1.7.122/sablono 0.3.6). It worked
fine in cljs file, but once I renamed it to cljc, it broke. Just a
destructuring in top-level form:

(rum/defc checkboxes-response [item opts]
(let [{id :entry/id
{choices :choices
max :max-selection} :item/attrs} item


Reply to this email directly or view it on GitHub
#67 (comment).

@jwr
Copy link
Author

jwr commented Sep 12, 2015

In my case, it's cljs and it only breaks when I compile using figwheel, launched from within the app. Normal compilation using cljsbuild works fine. Also, this used to work just fine, and recent updates broke it (I think newer ClojureScript versions caused the problem to appear).

I am afraid I have no idea of even where to look for this problem.

Don't worry too much — I removed all my toplevel destructurings for now as a workaround, so I'm fine for the moment. Enjoy your surfing!

@r0man
Copy link
Owner

r0man commented Feb 14, 2016

This was caused by macroexpanding ClojureScript code with Clojure's macroexpand. This is fixed since some time.

@r0man r0man closed this as completed Feb 14, 2016
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

3 participants