Fork me on GitHub
#clojurescript
<
2015-12-03
>
richiardiandrea00:12:00

Random development thought: it would be great to have a .cljc target for :nodejs

chrisoakman00:12:00

Does anyone know what version of Google Closure ships with CLJS? Specifically, I'm looking to use goog.functions.debounce (http://tinyurl.com/olmtmc3) and it's not being included in the compiled CLJS output

chrisoakman00:12:24

thanks @jaen - I guess that function just isn't present in that version of GClosure

dnolen12:12:49

@chrisoakman: we bundled Google Closure library on 10/16/2015, so latest releases should have that fn, it did when I checked at the REPL

chrisoakman16:12:56

thanks David simple_smile

Roman Liutikov17:12:44

@mahinshaw: I’ll check that error, thanks.

Roman Liutikov17:12:20

In case you see more errors on JS Bin, you can report theme here https://github.com/roman01la/jsbin-cljs

dreic18:12:10

the clojurescript koans don't work. Is there anything else to get me started?

dnolen19:12:02

@dreic: I just tried them, seems fine in Chrome

jstew19:12:24

The koans are working for me as well.

dreic19:12:18

@dnolen: @jstew yes, but for Firefox and Safari they are broken. Officially 😞 My Laptop is too slow for Chrome so I'm looking for alternatives.

dnolen19:12:49

@dreic: pretty sure there’s a github repo I would file an issue

dnolen19:12:53

must be something simple

jstew19:12:41

That's a bummer. This is clojure, not clojurescript, but these work: https://github.com/functional-koans/clojure-koans Just clone the repo and lein koan run

jstew19:12:05

There are subtle differences but I'm not sure that the koans go any further than the basics, so you may not run into any differences between clojure and clojurescript.

dreic19:12:33

ok, probably won't notice the difference yet

dreic19:12:36

thank you

donmullen19:12:49

@jstew - are the clojure-koans same as http://www.4clojure.com/ ?

jstew19:12:07

Both are nice ways to brush up on clojure, though.

dreic19:12:41

apropos 4clojure, why is (= "HELLO WORLD" (.toUpperCase "hello world")) correct?

dreic19:12:03

oh, the other way round.

dreic19:12:17

I get it.

dreic19:12:29

I read something like (= "HELLO WORLD".toUpperCase "hello world")

tolitius19:12:14

is there a way to get a namespace interns at runtime in cljs? ns-interns is a macro, ns-interns* does not return meta: https://gist.github.com/tolitius/c17b2d4a98eabb591926 , this is not (yet?) ported to cljc: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer/api.clj#L169

dnolen19:12:41

@tolitius: not possible, and it won’t ever be

dnolen19:12:59

all the Clojure runtime ns stuff is at odds with advanced optimizations

tolitius20:12:09

@dnolen: thank you. I thought maybe I would be able to eval it with "cljs on cljs" evolution, but I understand, have not thought about advanced optimization. is there a way to get all vars regardless the namespace?

dnolen20:12:58

you can do this statically but not at runtime

dnolen20:12:12

the rules are slightly different for bootstrapped

dnolen20:12:23

but these have never been enumerated or discussed

mfikes20:12:33

@tolitius: I can indeed do (-> ((ns-interns 'cljs.user) 'foo) meta) successfully using bootstrapped ClojureScript, but this means no :advanced

mfikes20:12:03

(You can compile and evaluate such a form.)

tolitius20:12:43

@dnolen: thank you. @mfikes: thank you. yes, bootstrapped was my next thought. although I understand :advanced is out. I'd still like to dig in to it, to understand it a little better. in your gist, you are doing it within repl, which re evals the ns-interns macro, i.e. same as: https://gist.github.com/tolitius/c17b2d4a98eabb591926#file-ns-interns-repl-cljs-L5, but you think it is also possible with "cljs on cljs"? I could not get to to eval with: https://github.com/swannodette/cljs-bootstrap (i.e. at runtime)

dnolen20:12:58

@tolitius: to be clear dropping :advanced means you are OK with 300K gzipped artifact at a minimum. If that’s not a problem for your app - go for it.

tolitius20:12:35

@dnolen: after you mentioned :advanced, I understand ns this is not the way to solve it. but since I already spent some time on solving these puzzles, I'd like to just see it through simple_smile

mfikes20:12:22

@tolitius: Yes, that was at a REPL, but it is essentially like taking the string I typed in, reading it into a form, and then calling cljs.js/eval on that form.

mfikes20:12:02

There is also cljs.js/eval-str.

tolitius20:12:05

@mfikes: I might be just at the beginning of my journey, but reading it into a form was where I had to stop and think, since env/*compiler*, where the analyzer gets a namespace, is not there at runtime

tolitius20:12:33

@mfikes: ah.. great, thanks. reading it. where would this suppose to come from: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/js.cljs#L769 (somewhere from cljs.compiler)?

mfikes20:12:46

@tolitius: FWIW, Replumb is probably a fairly “clean” codebase implementing REPL functionality on top of cljs.js, and is probably a good example of how some of the constructs are used. https://github.com/ScalaConsultants/replumb

mfikes20:12:32

I know you are not implementing a REPL, but it at least illustrates the concepts at play.

tolitius20:12:53

@mfikes: great, thanks Mike. these are very good reads/next steps

mfikes20:12:48

@tolitius: Cool. Feel free to ask questions. While, bootstrap is pretty new, lots of client codebases are successfully using it in pretty sophisticated ways at this point—pretty flawlessly simple_smile

tolitius20:12:42

@mfikes: great, thanks for your help!

richiardiandrea23:12:51

Hell all, a question: is cljs.test/function? valid in a deftest? I must be doing some dumb thing i cannot see it in my test namespace...

dnolen23:12:46

that’s probably an implementation detail really

dnolen23:12:52

it is not a function but a macro thing

dnolen23:12:06

and it only works on vars the compiler has already seen

dnolen23:12:24

i.e. no locals or any kind of aliasing allowed

richiardiandrea23:12:46

@dnolen oh that's why thanks, I really did not know