Fork me on GitHub

@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.


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.


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


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


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


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


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


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


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


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


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


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)