This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-20
Channels
- # aleph (2)
- # boot (18)
- # cider (3)
- # cljs-dev (14)
- # cljsrn (28)
- # clojure (428)
- # clojure-austin (3)
- # clojure-hk (1)
- # clojure-ireland (5)
- # clojure-mexico (1)
- # clojure-quebec (2)
- # clojure-russia (49)
- # clojure-spec (138)
- # clojure-uk (45)
- # clojurescript (70)
- # core-async (1)
- # cursive (8)
- # datomic (13)
- # defnpodcast (3)
- # devops (1)
- # editors (4)
- # events (1)
- # funcool (14)
- # hoplon (17)
- # jobs-rus (1)
- # luminus (5)
- # mount (51)
- # off-topic (21)
- # om (9)
- # om-next (8)
- # onyx (43)
- # planck (6)
- # re-frame (13)
- # reagent (18)
- # ring-swagger (1)
- # spacemacs (17)
- # untangled (18)
- # vim (13)
- # yada (21)
"Internal change to the way the AST is represented, which results in much faster compilation, especially for projects with large files." <- changelog from latest closure compiler. Will probably benefit cljs?
Anyone seen ERROR: Not supported: class java.util.regex.Pattern
coming out of CLJS compiler via com.cognitect.transit.impl.AbstractEmitter
?
@martinklepsch: I’m not sure if that’s the one, but I think I’ve seen something similar with a bad Guava transitive dep
(defn repro-breaks [{:keys [some-string extract]
:or {extract (fn [v] (re-seq #"(\S+)\s+" v))}}]
(extract (str some-string " abc")))
This breaks itI think it's not about using Transit but rather the compiler using transit for stuff (?)
hm, guava is at v19 which is what the compiler depends on
interestingly it doesn't happen when the pattern is def
d
Even more minimal:
(defn x [{:keys [extract]
:or {extract #"(\S+)\s+"}}])
Interestingly this works:
(fn [{:keys [extract]
:or {extract #"(\S+)\s+"}}])
Ah for my sente problem it turns out destructuring im defmethod did not work as I expected it to. (or rather the data had a different shape than expected)
@martinklepsch: can repro here with CLJS master
if I have an impure function I want to test, but it sits in another namespace, how do I go about that? I’ve looked at with-redefs, binding, and alter-var-root, but none seem to be able to handle /test/cljs/foo/foo_test.cljs
trying to rebind something inside /src/cljs/foo/foo.cljs
.
(defn foo [x] (other-namespace/bar x))
How can I ‘mock out’ other-namespace/bar, basically?(without changing the signature — hence looking at binding as opposed to a more pure signature (defn foo [x impl] (impl x))
)
@lwhorton: you can use with-redefs to redefine a referred function
at least in clojure/JVM
(with-redefs [foo.foo/bar (fn [something something] …)] test-body) should work
removed wrong example. the above works
the usual reasons rebinding appears not to work is lazyness or async calls
in other words, rebinding with with-redefs is only in effect while with-redefs has not returned
and lazyness etc can confuse things there
i see.. i could’ve sworn i tried that out but it was complaining about missing ns. I might have been missing foo.
and just tyring foo/bar
anyone know why a compile involving a cljsjs dep would succeed with lein figwheel
but fail with lein uberjar
or lein run
?
this is the error:
ERROR - required "data_analytics_web.components.fixed_data_table" namespace never provided
goog.require('data_analytics_web.components.fixed_data_table');
^
@johanatan: yup. didn’t sound like a cljsjs issue.
@johanatan: is the error same as before your latest namespace name change?
@johanatan: could it be a lein-cljsbuild compiler option issue?
btw, this issue occurs with the default re-frame template if you just add a subdirectory to the main src files location and name a namespace in it appropriately
@johanatan: could you post your repo on gh or something?
i.e., I am pretty certain that this is either a: clojurescript, lein, cljsbuild, uberjar or re-frame default template project.clj bug
@rohit: https://github.com/johanatan/sub-namespace-bug (and it does reproduce here)
@johanatan: cool.
@johanatan: your folder needs to be called sub_namespace
instead of sub-namespace
notice _
instead of -
i will update the sub-namespace-bug with the preferred folder name and I think it will still repro
@johanatan: i thought you meant folder structure as in the layout of directories and not the names
ok, looks like my original file name is "fixed-data-table.cljs" instead of "fixed_data_table.cljs"
that was it. thx for the help @rohit & @anmonteiro !!
Can anyone answer or point me to resources concerning if and when I should use deftype and defrecord in cljs?
@dfcarpenter: deftype is lightweight (compiles to barebone js-type), defrecord is deftype with bunch of cljs protocols implemented on top of it
here is the list of extra stuff you get with records: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L1713
if don’t need any of those stick with deftype, you can upgrade it to defrecord anytime later when the need arises
Thanks!