Fork me on GitHub
#cljs-dev
<
2019-05-03
>
mhuebert07:05:14

Hello all... I’m writing something up about creating JavaScript objects/literals in ClojureScript, and explaining the latest stuff I added to js-interop. I try to cover the #js tag and js-obj; not sure if I have missing anything, feedback would be welcome: https://www.maria.cloud/gist/9a8bf3d923a856ba222adccc2f737fbf?eval=true

john15:05:36

You might get some pushback on this line:

john15:05:43

"and informal benchmarks in the Chrome console would indicate that creating a blank object and then setting properties on it costs about the same as creating a literal object with the same properties"

john15:05:03

Some folks might try to split hairs with you on that.

mhuebert16:05:49

yeah, I would be interested in seeing if other people get different results. What I was seeing was so similar that I wondered if both forms were being handled the same way by v8.

john16:05:27

One thing you could maybe do is introduce the reader to the general issues and confusion that surrounds name munging and advanced compile. js-interop is really helping us out in making that all easier to deal with, but novices probably don't even have a solid understanding of what the problem is and why js keys do one thing sometimes and another thing other times.

mhuebert16:05:35

that is a good idea. am thinking that might need its own post.

john16:05:45

But that' may be too verbose of a tangent. The follow-along-with-code-examples is working well.

mhuebert16:05:52

may be able to show examples directly, via the closure compiler api service

john16:05:52

Just finished. Really good!

mhuebert16:05:41

thanks for reading! and for the ideas.

john16:05:00

Thanks for js-interop! 🙂

mhuebert16:05:09

i am doing some simple tests on https://closure-compiler.appspot.com and finding that even in simple mode, closure re-writes the “create blank object +then add properties” into literals

john16:05:45

I was wondering if that was happening

mhuebert16:05:30

the tests I did in Chrome / http://jsperf.com didn’t go through the closure compiler, but it wouldn’t be surprising if v8 does essentially the same

lread17:05:13

Hey… I submitted my first cljs patch: https://dev.clojure.org/jira/browse/CLJS-3075 - I think I followed procedure correctly. I took the liberty of assigning to @mfikes because he was the one who reviewed changes I made to https://clojurescript.org/community/running-tests which references the script I updated.

lread17:05:44

Thank you @mfikes! I have been watching you and your friends on Apropos Clojure on youtube. Great stuff!

mfikes17:05:58

Ahh. Thanks!

lread18:05:00

I don’t mean to pester you… but I also do have a related doc change to the one I made the other day… https://github.com/clojure/clojurescript-site/pull/313