I found this error while interop-ing with scittle, I did found some workarounds, but why is this?
<script>
var a_value = "hello a_value"
var another = { value: "hello_another_value"}
</script>
<script type="application/x-scittle">
(println js/a_value)
(println js/another.value)
;; (set! js/a_value "goodbye a_value") ;; this is an error "Invalid assignment target"
;; (set! js/another.value "goodbye another_value") ;; this is also the same error
(set! (. js/window -a_value) "goodbye a_value")
(println js/a_value)
(set! (.. js/another -value) "goodbye another_value")
(println js/another.value)
(set! (.-value js/another) "goodbye another_value 2")
(println js/another.value)
</script>
@kyogatama officially you have to write (set! (.-a_value js/document) ...)
$ nbb
Welcome to nbb v1.2.173!
user=> (set! (.-a_value js/globalThis) 3)
nil
user=> js/globalThis.a_value
3I see, I was not expecting the error since it works in clojurescript. But I only use it in one line in my code so this is no big deal then
the official syntax is what I just stated, the other one just happens to work because of the code that gets emitted, by luck stick to the official syntax and it will work in both targets
Will do! so that's why it's hard to find documentation on these js/some.thing when I was trying clojurescript for the first time