Clojurians
#cljs-dev
<
2016-12-15
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

thheller11:12:52

I just noticed the weirdest dead code optimization

thheller11:12:14

(def foo 1)

(def bar {:baz (str "foo" foo)})

thheller11:12:30

$cljs$core$str$$("foo");
$cljs$core$str$$(1);

thheller11:12:46

(with pseudo-names)

thheller11:12:03

did not expect closure to kill the entire map

thheller11:12:22

and just leave the "side effects" lingering

thheller11:12:43

not a bad thing, just surprised me

thheller11:12:25

wonder if there is a way to tell closure that it doesn't need to call the things if the map isn't used

rauh12:12:09

@thheller Yeah weirdly the @nosideeffects option is only allowed in externs :confused:

thheller12:12:56

well it wouldn't be fun to annotate everything with that :wink:

thheller12:12:25

I'm more surprised that the map is removed though, did not expect that at all

thheller12:12:42

Closure never ceases to amaze :slightly_smiling_face:

favila15:12:44

@rauh Closure determines function purity via analysis. @nosideeffects is only needed in externs because the function implementation is not available.