@pesterhazy @richiardiandrea thatβs what I meant by an evented reader https://gist.github.com/cgrand/d99afba8ce7ae9a13931184a58bbffc8 (not complete yet)
@cgrand aset is for arrays. You want goog.object, aset works by coincidence.
@dominicm source that it is frowned upon/not guaranteed to keep working?
https://cljs.github.io/api/cljs.core/aset these docs. Also conversations with @anmonteiro (who can probably point at the correct source)
yeah dnolen doesn't like aget/aset used for JS objects
@cgrand (:require [goog.object :as gobj])
(gobj/set obj "foo" 1)
it is more about the closure compiler really
one source: https://lambdaisland.com/episodes/clojurescript-interop
they don't like obj["foo"] = 1
@thheller using brackets makes the closure compiler not minify the properties, but not minifying is often exactly what you want
goog.object
is inlined to the above as well and won't be renamed
I think the point is more that aget/aset exists in clojure and operates on arrays, and the fact that it works for objects is an implementation detail you don't want to rely on
goog.object
just interacts better with the closure type system
I agree goog.object/set is the way to go
I didn't know that there's an interaction with the closure type system
fun fact: goog.object is automatically required so you should be able to use it without the require clause
I hate using the long name π ... also always require everything you use ... will only lead to issues if you dont
yes I guess you're right
oh I wish that gobj/get and gobj/set were part of cljs.core
but that ship has sailed π
Thanks all
Sorry. Didn't mean to turn this into a big conversation π That code looks really useful.