Fork me on GitHub
#cljs-dev
<
2017-11-18
>
thheller07:11:37

@favila yes. the compiler could set :features #{:cljs-macro :cljs} when compiling macro namespaces. you could still use :cljs as usual but :cljs-macro if you really need something to be macro only. :clj stays as is.

mfikes17:11:01

An interesting point was raised by @juhoteperi in #clojurescript : The checked variant of aset has the notion that the index must be within the existing array, while on the other hand, if you take the stance that a- fns are fundamentally hosty, then you would not place an upper bound on the numerical index value, and let the host JavaScript array grow.

juhoteperi19:11:00

Does Closure rename properties in objects which are created with #js or clj->js?

mfikes20:11:08

@juhoteperi My guess would be yes, for #js, because it can see the JavaScript, but it can’t for clj->js

juhoteperi20:11:09

Reagent builds one object using reduce + aset (or goog.object/set if I fix that), and currently calls methods from the object in a way that Closure doesn't rename methods

juhoteperi20:11:33

If I fix all the calls to use just normal property access or method call, I can't call methods from that object

thheller20:11:00

closure doesn’t rename anything that comes out of clj->js. but it will rename everything you call on the result

thheller20:11:42

(.foo (clj->js {:foo (fn [] ..)}) will rename the .foo

thheller20:11:18

#js should not be renamed either since its emitted as strings

thheller20:11:06

closure doesn’t like dynamically constructing properties so you’ll need externs for the property names you construct

juhoteperi20:11:36

I can't know the names, as the object is React component, and could have additional lifecycle properties for libraries etc.

juhoteperi20:11:25

Hmm, well, those libraries will have externs in most cases, but then it wouldn't work when React and libraries are also optimized (without externs)