This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-02
Channels
- # babashka (37)
- # beginners (19)
- # calva (5)
- # cider (14)
- # clojure (21)
- # clojure-europe (2)
- # clojurescript (16)
- # conjure (11)
- # datalog (78)
- # deps-new (3)
- # gratitude (2)
- # introduce-yourself (1)
- # joker (1)
- # jvm (4)
- # lsp (17)
- # malli (5)
- # meander (6)
- # minecraft (3)
- # off-topic (17)
- # other-languages (25)
- # practicalli (1)
- # quil (12)
- # reveal (6)
- # spacemacs (19)
I'm curious if a lot of production cljs uses the Google Closure library. I know the compiler uses it for optimizations but do folks also use the library and it's functions as well?
The cljs book I'm reading is introducing it and it seems like something I would want to invest some good time into.
I'm also creating an issue for clojure-lsp to get some documentation and autocompletion support for it but didn't want to waste their time if the community doesn't use the library much for some reason.
Just in case - Google Closure Compiler is used for building and optimization.
Google Closure library is used by CLJS itself, right in core.cljs
. In fact, the CLJS part of cljs.core
doesn't require anything but the goog
stuff.
Ahh, thanks for the clarification. I didn't know cljs itself was written using the library.
Closure library contains tons of useful utils. Usually when I have an itch to pull in a library I first check if closure lib has something. And quite often it does. Upside is that “it’s already there” and the closure compiler can do advanced dead code elimination on all that.
Grepping from one of my projects and found these in addition to borkdudes list: goog.array
goog.color
goog.crypt
goog.labs.userAgent.browser
goog.date.duration
greetings! given
ClojureScript 1.10.339
(pop [])
Can't pop empty vector
(pop ())
Can't pop empty list
(pop nil)
nil
(pop (seq ()))
nil
are there any objections to something like: ?
(extend-protocol IStack
cljs.core/Cons
(-peek [coll] (-first coll))
(-pop [coll] (-rest coll))
cljs.core/IndexedSeq
(-peek [coll] (-first coll))
(-pop [coll] (-rest coll))))
because:
(pop (new IndexedSeq [1 2] 0 nil))
No protocol method IStack.-pop defined for type cljs.core/IndexedSeq
(pop (cons 1 [2 3]))
No protocol method IStack.-pop defined for type cljs.core/Cons: (1 2 3)
(type (seq [1]))
cljs.core/IndexedSeq