This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-21
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (96)
- # cider (5)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (22)
- # clojure-austin (2)
- # clojure-russia (16)
- # clojured (2)
- # clojurescript (65)
- # css (4)
- # cursive (89)
- # datomic (7)
- # emacs (89)
- # events (1)
- # hoplon (126)
- # leiningen (2)
- # off-topic (2)
- # om (268)
- # onyx (19)
- # parinfer (42)
- # re-frame (5)
- # reagent (30)
- # yada (8)
Hi guys, I need a hand, I renamed my root package in cljs and the compiler tells me:
clojure.lang.ExceptionInfo: failed compiling file:src-cljs/frontend/handlers.cljs
...
Caused by: java.lang.Exception: No namespace: frontend.utils found
@mfikes, thanks I tried that already, went nuclear with lein clean
then rm every possible compiled file
OK, I got that wrong already, long time without clojur'ing, I forgot these tiny details
utils.clj require is:
(ns frontend.utils
(:require-macros
[cljs.core.async.macros :refer [go]])
(:require
[cljs.core.async :refer [<!]]))
Yea, so I merged everything in :require
, but now I get:
Caused by: java.io.FileNotFoundException: Could not locate cljs/core/async__init.class or cljs/core/async.clj on classpath.
@lsenta: You are going down a path (using core.async
from within macros that I have no experience with). Perhaps you simply need to ensure that the Clojure version of core.async
is also on your classpath
Caused by: java.io.FileNotFoundException: Could not locate clojure/core/async/macros__init.class or clojure/core/async/macros.clj on classpath.
😞@lsenta: You might be OK, so long as the result of the macro expansion yields stuff that ends up being useful from ClojureScript. That’s the interesting twist.
Yea that's what is bothering me, I doubt the expansion of cljs.async is the same than the clojure.async
@lsenta: What does your require look like? It is telling you the truth. There is no such namespace as clojure.core.async.macros
. Maybe that’s it
In other words, in the Clojure version of core.async
the macros are right in the clojure.core.async
namespace.
@lsenta: Depending on what you are really trying to do, I think I’d consider macros that themselves don’t directly refer to Clojure core.async
, but expand to forms that refer to ClojureScript core.async
, which are then further expanded, etc., if that makes sense.
@lsenta Yes, that's what happening. I think the way to go is to use fully qualified named but with quote-unquote, like in ~'cljs.core.async.macros/go
And then, you should do the :require-macros
of clj.core.async... macros in the namespaces where you use the macro (instead of in frontend.utils)
@mfikes @nberger It works, thanks a lot for the help guys, I owe you a load of debugging hours!
is there a way for emacs eval of clojurescript to actually show me exceptions in a buffer, like how it does with clojure
I am running a ClojureScript REPL using Cursive + Figwheel. I have Def’d some data in a module, and when I print it - it appears as expected, but prefixed is the following warning:
WARNING: Use of undeclared Var hello-app.core/test-data at line 1 <cljs repl>
What is the reason for this? Is it something I should worry about?usually indicates that you've got a line of code that refers to a variable called test-data
that is not actually defined
This is my REPL
hello-app.core=> test-data
WARNING: Use of undeclared Var hello-app.core/test-data at line 1 <cljs repl>
{:list/items [{:ID 1, :userDescription "A test item"}]}
hello-app.core=>
@jamesmintram: that can occur if your REPL isn't aware of the var, but it has actually been initialized in your JavaScript engine
@jamesmintram: :analyze-path
deals with one use case surrounding this. I've written a post with some exposition on it: http://blog.fikesfarm.com/posts/2015-06-10-analyze-path-ftw.html
Hi @mfikes that looks exactly like the problem I had! (In the end I did a clean and rebooted the Repl)
Thanks
@mfikes Would you know how to use this with figwheel? My current repl.cljs file looks like this.
(use 'figwheel-sidecar.repl-api)
(start-figwheel!) ;; <-- fetches configuration
(cljs-repl)
@jamesmintram: No. All I can say is :analyze-path
is a standard REPL option: https://github.com/clojure/clojurescript/wiki/REPL-Options
OK - thanks for your help. I will go and take a look
I'm formatting url templates retrieved from a python flask server formatted like "/path/<arg1>/<arg2>/etc" and I'm replacing <args> supplied from a vector. My old js implementation splits, loops, replaces and shifts vector until empty and then joins. Is there a more idiomatic Clojure approach?
am i doing something wrong here? trying to do (:require [goog.events.KeyCodes :as key-codes]) in my ns form, but key-codes ends up being undefined in my program
https://github.com/jrheard/cljs-sandbox/blob/master/src/cljs_sandbox/boi.cljs relevant code
@jrheard: You need to use :import
instead. Here is a really good explanation of when to use which http://clojurescriptmadeeasy.com/blog/when-do-i-use-require-vs-import.html