Fork me on GitHub
#clojurescript
<
2017-07-25
>
mattgeb00:07:23

Stupid question: So, with the new Node package interop, do I add the NPM deps to the Project.clj or just the Build.clj?

rarous05:07:17

Into your cljs compiler options. If you use cljsbuild then in project.clj otherwise build.clj.

borkdude09:07:31

Has anyone seen this warning before? WARNING: Use of undeclared Var cljs.js/lib at line 450 …/.boot/cache/tmp/…/app/cm9/pref5e/public/js/app.out/cljs/js.cljs

mfikes12:07:04

@borkdude Yes. It is fairly innocuous and an (if anything) affects self-host: https://dev.clojure.org/jira/browse/CLJS-2141

chalcidfly15:07:15

Why is the AST for ((fn [a b] (+ a b)) 5 7) almost 3000 lines long? For proof, see http://tiny.cc/cljs-ast

chalcidfly15:07:29

Real question, that site’s just a place to see for yourself

mccraigmccraig15:07:10

it's got the environment expanded at every node... most of the bulk is under :env keys

Alex Miller (Clojure team)15:07:12

because AST is very verbose

chrisbroome15:07:29

looks like there's a lot of :js-globals that are repeated in various nodes

Alex Miller (Clojure team)15:07:33

most of those are actually the same identical object referred to from multiple locations

chalcidfly15:07:19

is there a way to get a brief version?

chalcidfly15:07:26

Like an existing AST-cleaner lib

chalcidfly15:07:31

oh, sweet. I’ll check that out.

chalcidfly16:07:48

@bronsa I can’t seem to require that namespace in figwheel. (require '[cljs.analyzer]) works but (require '[cljs.analyzer.utils]) doesn’t.

mfikes17:07:00

@chalcidfly That code is Clojure (it is in a file ending with *.clj; you’ll need to essentially copy the relevant code you desire to a ClojureScript file (`*.cljs` or *.cljc)

chalcidfly17:07:13

oh, thank you.

tomjkidd17:07:32

Is there a tool that people here use to detect things like unused namespaces in .cljs files?

tomjkidd17:07:53

@rgdelato Thanks, I’ll take a look!

tomjkidd18:07:03

@rgdelato find ./src -type f -name "*.cljs" | xargs -n 1 joker --lintcljs worked quite nicely!

shader19:07:51

how would you make a function like keyword that takes a string and makes it a fully qualified keyword in the current namespace?

jeaye19:07:07

user=> (keyword "foo-bar.spam" "meow")
:foo-bar.spam/meow

shader19:07:20

I found that apparently you can't get the namespace at runtime in cljs, so I got the namespace in a macro via (get-in &env [:ns :name]) instead

yedi21:07:20

if i'm writing code to manage state in a SPA / re-frame app that has to interface with a remote API, does it make sense to use core.async? or should i just go with something simpler like a promise library?

Roman Liutikov21:07:22

@yedi just use promise/deferred if all you have is request/response cycle

Roman Liutikov21:07:10

core.async would make more sense if you would have complex data flow in the app, like many dependent requests for example

yedi21:07:35

sounds good, thanks

thheller21:07:36

FWIW I think core.async is much simpler to use than promises

anmonteiro21:07:50

also a bigger dependency to take on