This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-15
Channels
- # announcements (13)
- # beginners (106)
- # cider (70)
- # cljdoc (1)
- # cljsjs (1)
- # clojure (97)
- # clojure-finland (1)
- # clojure-italy (13)
- # clojure-mexico (16)
- # clojure-russia (1)
- # clojure-spec (53)
- # clojure-uk (146)
- # clojurescript (44)
- # core-async (5)
- # cryogen (1)
- # css (1)
- # cursive (11)
- # datomic (89)
- # duct (10)
- # emacs (4)
- # figwheel-main (58)
- # fulcro (5)
- # hispano (35)
- # hyperfiddle (1)
- # jobs (2)
- # jobs-discuss (1)
- # lambdaisland (1)
- # leiningen (3)
- # off-topic (13)
- # onyx (50)
- # parinfer (3)
- # pedestal (4)
- # reagent (9)
- # ring-swagger (56)
- # rum (3)
- # shadow-cljs (85)
- # spacemacs (4)
- # vim (4)
@jarvinenemil IMO you’re almost always better served by using js/fetch directly, even in cljs. Wrappers cause nothing but trouble
re-frame-http-fx wraps cljs-ajax, which wraps XhrIo, which wraps XHR...
Is it possible to compile.cljs files as Clojure? I have written some ClojureScript code and my most important namespace has got nothing to do with JavaScript. I’d like to be able to use it as both Clojure and ClojureScript. I am using leiningen and cljsbuild - nothing else.
Yes. You need to rename the cljs file from .cljs
to .cljc
. If the file contains some parts that should be different for Clojure and ClojureScript, you can use reader conditionals which are explained here: https://clojure.org/guides/reader_conditionals
Oh, and you need make sure that the file is in a directory that can be seen both by the Clojure and ClojureScript side – maybe it already is. So you want to have the file in directory that is in Leiningen's and cljsbuild's :source-paths
A propos cljc, how do you test errors in a portable way? I tried:
(def assertion-error
#?(:clj java.lang.AssertionError
:cljs js/Error))
;...
(is (thrown-with-msg? assertion-error #"Assert failed: (map? x)" (sut)))
but clj doesn't like it: java.lang.IllegalArgumentException: Unable to resolve classname: assertion-error
I think you need to inline assertion-error
. thrown-with-msg?
is part of clojure.test macro magic and using variables in there is not going to work. 😐
Hmm, makes sense. Maybe the best way is to create an is-thrown-with-msg?
macro that ouputs that whole (is ...)
line
I am making pseudo-announcements here just to pre-flight the doc on my new CLJS Web framework. The Real Deal will come after some reference doc to go with the intro scenery chewing. This should be the last in the chewing trilogy. https://github.com/kennytilton/mxtodomvc/blob/master/documentation/InDepth.md It is a fun reminder of how much of the UI code Mr. Hickey dreads can be automated. As always, feedback welcome.
I know some folks have this set up and its really working well for them. This will make it much easier.
man bummer. yeah there's no feature queries.. @noprompt any plans or thoughts or workarounds?
@idiomancy mmm. there’s no direct support for it but i think you could add it pretty easily.
i forget the semantics of @supports
but i think at some point i was messing with that.
i’ve been working on a top secret project for a little while now and haven’t given garden attention in a bit.
well, you've earned your secret project time. this stuff is really handy and you're awesome 😄
heh, if i get some front end opportunities, that’ll probably motivate me to hack on it some more.
I am running into a strange issue when enabling Spec instrumentation and haven't figured out how to reproduce it yet. Curious if anyone can shed some light on this issue. I have a function that takes arguments like this [x y z & more]
. It has a fdef
that looks like this:
(s/fdef reg-query-sub
:args any?
:ret fn?)
I am calling reg-query-sub
like this: (reg-query-sub :a {} [])
. When instrumentation is enabled, I get this error thrown in the console:
Error: :a is not ISeqable
at Object.cljs$core$seq [as seq] (core.cljs:1223)
at Object.cljs$core$bounded_count [as bounded_count] (core.cljs:3725)
at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (core.cljs:3888)
at Function.G__40458__delegate [as cljs$core$IFn$_invoke$arity$variadic] (alpha.cljs:112)
at compute$ui_frontend$re_frame$reg_query_sub (re_frame.cljs:217)
at Object.cljs$core$apply_to [as apply_to] (core.cljs:3845)
at Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$2 (core.cljs:3890)
at Object.G__40458__delegate (alpha.cljs:112)
at Object.G__40458 [as reg_query_sub] (alpha.cljs:107)
at eval (subs.cljs:31)
Because that error seems to be incorrect, I enabled the debugger in Chrome and set it to pause on caught exceptions. Walking down the call stack, I inspect the values of the vars in scope. When I get to G__40458__delegate
(the 4th item in the stack), I see the value for args
is :a
, which is incorrect thus the error. Continuing the walk down, I see G__40458__delegate
again (8th item in the stack). This time its args
are a vector of the items I passed it - [:a {} []]
. Moving down the stack one more level I get to G__40458
which has several definitions of args
. The first 3 are correct, but the last one is :a
.
I'm not really sure how to go about debugging this issue any further. Does anyone have any thoughts?