This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
@meow: I suspect you think js
is more sophisticated than it actually is. It doesn't really do anything.
@meow: https://github.com/clojure/clojurescript/blob/a3dc10bc333aa4ad0178c3e23dcaba87bbaea505/src/main/clojure/cljs/analyzer.cljc#L525
@meow: that’s all the info that comes out of a js/
symbol analysis, and then that info is emitted here and passes through the munge
function: https://github.com/clojure/clojurescript/blob/a3dc10bc333aa4ad0178c3e23dcaba87bbaea505/src/main/clojure/cljs/compiler.cljc#L303
munge
is a little hard to follow, it’s changed since I last looked at it, but I’m sure it just strips the js/
out of the symbol and emits it
@jellea: I played with core.async animations using a go-loop that listened to a timeout
channel
and also played with requestAnimFrame that wrote dt values to a mult
channel that other go-loops could listen to
but I actually got myself into some trouble using the latter with channel back-pressure I think, the requestAnimFrame was writing too many values to the channel. I never figured that out
I would just play with the timeout
channel:
(go-loop []
(<! (timeout (/ 1 60))
(swap! state update-in [:x] inc) )
some example code for the requestAnimFrame channel thing, with the aforementioned problems on slower machines: https://github.com/shaunlebron/solar-system-of-js/blob/master/src/solar_system_of_js/animate.cljs
@shaunlebron: awesome! thank you for those links. I had fun looking through a bunch of the cljs source code, just couldn't find where that particular trick took place. Thanks.
@shaunlebron: Think I’ll go for the go-loop + timeout then! Thank you!
@meow: ah I misunderstood. You were digging into the compiler. cljs.analyzer/resolve-var
, notice it just skips everything.
@dnolen: yes, I saw that. Also this little trick
(defn implicit-import? [env prefix suffix]
(contains? '#{goog goog.object goog.string goog.array Math} prefix))
optimization thing around invocation - but heading into the weeds now IMO Unless of course that's your kind of thing.
@meow: see the :invoke
case of emit*
in cljs.compiler
. It's a pretty gnarly piece of code but a big reason ClojureScript code is hot-swappable under dev but fast under production.
@dnolen: not sure if I'm going to have time to track this down today but does this smell bad to you at all: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L499
@dnolen: I'll work on a patch - probably won't see it until Tues or Wed as I've got things going on.
@sander: good catch with the recur
, always forget that