This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-12
Channels
- # aws (3)
- # beginners (28)
- # boot (3)
- # cider (28)
- # clara (5)
- # cljs-dev (107)
- # cljsrn (1)
- # clojure (40)
- # clojure-austin (2)
- # clojure-brasil (5)
- # clojure-canada (1)
- # clojure-italy (1)
- # clojure-spec (39)
- # clojure-uk (38)
- # clojurescript (33)
- # community-development (11)
- # cursive (11)
- # datomic (43)
- # duct (6)
- # emacs (7)
- # flambo (1)
- # fulcro (68)
- # graphql (11)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (16)
- # luminus (2)
- # lumo (1)
- # off-topic (38)
- # om (2)
- # onyx (15)
- # parinfer (32)
- # portkey (5)
- # re-frame (50)
- # reagent (50)
- # reitit (1)
- # shadow-cljs (63)
- # spacemacs (10)
- # sql (27)
- # unrepl (6)
- # yada (2)
Hi! In ES6, having 3 variables, I can do { msg, status, env }
and get { msg: msg, status: status, env: env }
. Is there a similar trick for clj(s) (other than writing my own macro or defining a record with these field) to do that or do I need to manually write { :msg msg, :status status, :env env }
? Thanks! #DRY
You can use a macro: https://github.com/metosin/potpuri/blob/master/src/potpuri/core.cljc#L72-L77 (I recommend copying this to your own util ns if you choose to use this)
if you can do that, it means that data is already somewhere. if that "somewhere" is a map, do this: (select-keys data #{:msg :status :env})
the data is in local bindings from let
😞
Is cljs.spec.alpha
a part of latest clojurescript and I can just require it or is it a separate lib? Couldn't find it on clojars/maven?
clojure.
, not .cljs
? From http://cljs.github.io/api/cljs.spec.alpha/ I would expect cljs...
i dont remember from which version but clojurescript should "translate" namespaces from cljs to clojure
ok, I find it: https://cljs.github.io/news/1.9.198
Thank you so much!
@pablore just handle the promise as in js
(-> p (.then do1) (.then do2))
also take a look at promesa library http://funcool.github.io/promesa/latest/
You can use a macro: https://github.com/metosin/potpuri/blob/master/src/potpuri/core.cljc#L72-L77 (I recommend copying this to your own util ns if you choose to use this)
I was thinking about using the expectations library in an atom validator during development. Question: what’s the normal (simple) way of ripping the library and validators out of production?
i guess it’s sort of a dumb question. in node, there is a de facto practice of setting NODE_ENV=production and lots of libraries follow that. my question is really: is there a similar practice here?
There is goog.DEBUG variable. And :advanced would remove unused code.
does clojurescript allow turning assertions off in the same way clj does?
oh, you want to remove the whole library too?
obviously i could just cook up something myself by setting a variable and not using the library. i could then either hope that the optimizer kills the unused code or figure out some kind of reader macro thing to remove the require statement (i have no idea how to do that so that’s why i’m asking if there’s an obvious easier way)
if it doesn’t exist yet it would be really cool to see it implemented
well the cljs assert macro uses *assert*
, which is set with a compiler option, to remove assertions. it says not to use “manually” but I think that means don’t set it manually. reading it to do development-only validations makes sense to me.
is clj->js
what you're looking for?
I'm seeing some cljs compilation behavior that I don't understand, hoping someone here can help me out. With clojurescript 1.9.946 and tools.reader 1.1.0, I'm seeing the "no reader function for tag Inf" problem described here: https://stackoverflow.com/questions/48039878/cljs-core-cljs-line-988-col-14-no-reader-function-for-tag-inf. I upgraded tools.reader to 1.2.1 and that issue went away. Now I'm getting the invalid js output issue described here: https://dev.clojure.org/jira/browse/CLJS-2352. I'm not sure what I've got wrong, since the dependency versions are right. I verified dependency versions using lein deps :tree
- if there's a better way to check the versions please let me know.