This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-27
Channels
- # announcements (2)
- # babashka (60)
- # beginners (73)
- # calva (23)
- # cider (2)
- # clj-kondo (19)
- # cljs-dev (31)
- # clojure (29)
- # clojure-berlin (1)
- # clojure-europe (6)
- # clojure-nl (17)
- # clojure-spec (21)
- # clojure-uk (15)
- # clojurescript (54)
- # core-async (48)
- # cursive (35)
- # datomic (12)
- # emacs (12)
- # fulcro (66)
- # graalvm (3)
- # graphql (16)
- # jackdaw (1)
- # malli (1)
- # off-topic (11)
- # pedestal (4)
- # re-frame (10)
- # reitit (1)
- # rewrite-clj (8)
- # ring-swagger (8)
- # shadow-cljs (14)
- # spacemacs (2)
- # vim (5)
Interesting problem with JS iterables and mutability, see comment in the ticket https://clojure.atlassian.net/browse/CLJS-3199 One solution would be to realize the whole iterator at seq creation time. With this we could also use IndexedSeq instead of special ES6IteratorSeq type. The downside is that behaviour wouldn't exactly match Clojure, where iterator is realized lazily in chunks.
Consuming iterables lazily could be useful.
I’m not sure that I (as a potential user of this) care about the difference between CLJS and CLJ w.r.t. mutation
cljs.user> (def foo #js [1 2 3])
#'cljs.user/foo
cljs.user> foo
#js [1 2 3]
cljs.user> (def foo-seq (array-seq foo))
#'cljs.user/foo-seq
cljs.user> (aset foo 0 2)
2
cljs.user> foo
#js [2 2 3]
cljs.user> foo-seq
(2 2 3)
Also in Clojure nothing stops you from mutating nested java collections in a seq, so maybe that's fine.
I've chatted about this briefly with @mfikes, still would like to get more input on this.
(defonce x js/v)
would still eval after reloads when js/v
is undefined
. This happens because exists?
checks for undefined
, but in cljs we treat both null
and undefined
as nil
. I propose to change the check to ns.hasOwnProperty(x)
specifically for defonce
, but also I'm wondering if this should go into exists?
as well?
remember that foo.bar/x
is flattened to var xT
(or anything like that) in :advanced
and there is no "property" to check
yeah that’s a good point
@roman01la I'm confused as to why it matters that will eval when it evals to undefined
we can't do anything about mutation - I would say not a big deal - realizing the whole thing is not a good idea
I often bump into something like this (defonce init ((fn [] (js-undefined-returning-fn))))
, every time it takes me some time to figure out the problem. But I’m also fine to leave it as is.
yes, I was talking specifically about undefined
This also popped out in https://clojure.atlassian.net/browse/CLJS-3195, I think the patch there should still make sure that “no value” is null
, not undefined