This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-09
Channels
- # aleph (4)
- # arachne (3)
- # beginners (41)
- # boot (300)
- # cider (17)
- # cljs-dev (37)
- # cljsjs (4)
- # cljsrn (5)
- # clojure (249)
- # clojure-boston (3)
- # clojure-czech (4)
- # clojure-dev (14)
- # clojure-greece (183)
- # clojure-nl (2)
- # clojure-russia (11)
- # clojure-spec (135)
- # clojure-uk (37)
- # clojurescript (56)
- # community-development (8)
- # cursive (22)
- # data-science (4)
- # datomic (150)
- # devcards (6)
- # emacs (5)
- # euroclojure (8)
- # funcool (18)
- # hoplon (29)
- # immutant (1)
- # jobs (1)
- # lambdaisland (3)
- # lein-figwheel (7)
- # leiningen (18)
- # mount (1)
- # om (81)
- # onyx (95)
- # planck (50)
- # proton (6)
- # re-frame (62)
- # reagent (2)
- # ring (1)
- # robots (1)
- # spacemacs (2)
- # specter (88)
- # test-check (32)
- # untangled (23)
- # yada (1)
I'm sure this gets brought up often enough someone could point me to a few good links: I have a colleague who's vehemently opposed to transpilers because they add a layer of complexity to the execution model. Not that he prefers JS for performance first, but that he wants to know what his program is executing and be able to optimize it if needed. This is a common sentiment, right? What are some of the best cljs-specific blog posts addressing this?
@stewsquared: ClojureScript is designed to reach whatever perf characteristics JS has if that’s what you want
This works: (.findAll coll #js {"e" 2} #js {"e" 3})
where coll
is a JS object with a method function findAll
. I'm trying to use apply
because I have the two maps in a ClojureScript vector but I can't quite get the incantation right. I understand there's some hijinks when the JS method function uses this
, but it's not clear to me what the apply
call would look like assuming no this
problems were there. (apply .findAll coll [...])
?
The function findAll
(not mine, from a library) uses arguments
and its code appears to include this
. Does this use of this
in the body imply I cannot use a straightforward apply
(whatever that would look like)?
Got it. (.apply (.-findAll coll) coll #js [ #js {"e" 2} #js {"e" 3}])
works whereas what I think would be an equivalent, (`(apply (.-findAll coll) #js [ #js {"e" 2} #js {"e" 3}]) ; :(`) doesn't work. So I'm guessing findAll
uses this
and I can't use ClojureScript's apply
. No worries
@dnolen: I suppose he's worried about not being able to optimize past clojurescript's base overhead. Admittedly, his concerns seem really vague.
@stewsquared: By the same logic, writing C is adding a layer of complexity on top of pure machine code. You don't know what your program is executing (because compilers do some wacky stuff to your code) and it's prety hard to optimize it, too!
Premature optimization's never a good idea. It's fine to roll with ClojureScript, and it does turn out to be not performant enough, you can always refactor your ClojureScript code or, if all else fails, just embed plain old JavaScript.
I'm trying to use the function decodeStringToUint8Array
from http://google.github.io/closure-library/api/namespace_goog_crypt_base64.html, but it doesn't seem to be available, what can I do to have it available?
@wilkerlucio: looks like it is unavailable in clojurescript because it was added in a newer version of the closure library
humm, ok, makes sense
how we go about updating it? can I expect it to be updated in a near future version of clojurescript?
@wilkerlucio: no idea, maybe better to ask in #C07UQ678E
@wilkerlucio: we need to cut a new release of the closure library that we build
@dnolen: can we do that for the next release? can I help somehow?
@wilkerlucio: in this case unfortuantely not, I just have to kick off a build, will do this tomorrow
@wilkerlucio: you can file a ticket in JIRA and set the fix version to Next
@dnolen: filed http://dev.clojure.org/jira/browse/CLJS-1675, I just didn't figured how to change the fix version
@wilkerlucio: thanks!
@wilkerlucio: you submitted a CA right?
@dnolen: not yet, can you send me one please?
@wilkerlucio: you need to do the official one 🙂
where can I find it to sign?
you can do it online, soon as you send that let me know and I will bump your JIRA privileges so you can always do what you need in JIRA
@dnolen: ok, submitted 🙂
@wilkerlucio: you should be able to edit the ticket now
ok, just did, should I assign the ticket to you?
Morning. Anyone now why find-ns-obj
works in advanced mode for user-defined namespaces but not for cljs.core?
@cldwalker: none of thing at the bottom of cljs.core is intended for anything except bootstrapped
it is possible to somehow get docstrings dynamically during runtime? I don’t see them emitted in the generated js sources, so I doubt it.
@darwin: I suppose this is not “dynamically” ?
cljs.user> (defn a "docstring here" [] 42)
#'cljs.user/a
cljs.user> (-> #'a meta :doc)
"docstring here"
@anmonteiro: thanks, my situation is, that someone gives me “a” as a string dynamically
I doubt that’s possible because of the static nature of vars in CLJS
happy to be proven wrong though 🙂
SEVERE: ERROR - Duplicate input: file:/C:/Users/Us/.m2/repository/org/clojure/google-closure-library/0.0-20151016-61277aea/google-closure-library-0.0-20151016-61277aea.jar!/goog/base.js
Jun 09, 2016 9:06:16 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
ERROR: JSC_DUPLICATE_INPUT. Duplicate input: file:/C:/Users/Us/.m2/repository/org/clojure/google-closure-library/0.0-20151016-61277aea/google-closure-library-0.0-20151016-61277aea.jar!/goog/base.js at (unknown source) line (unknown line) : (unknown column)
Has anyone seen that error and know what causes it? Happens on OS X too.
make sure you don’t somehow have your output directory on the classpath or something like that
(ns hara.common.checks
#?(:cljs (:require [goog])))
;; ## Type Predicates
;;
;; Adds additional type predicates that are not in clojure.core
(defn boolean?
"Returns `true` if `x` is of type `java.lang.Boolean`.
(boolean? true) => true
(boolean? false) => true"
{:added "2.0"}
[x]
#?(:clj (instance? java.lang.Boolean x)
:cljs (goog/isBoolean x)))
I’ve tracked it down to this codeam I requiring goog
in the wrong way here?
@danielcompton: do not require goog, it gets required automatically
just today I hit similar issue, requiring goog is side-effecting and wipes out goog’s internal data structures
so just call goog/isBoolean
?
take my words with grain of salt, I didn’t have time to investigate it further, but in my situation, this line was the first major issue: https://github.com/google/closure-library/blob/master/closure/goog/base.js#L840
Looks like goog
is imported by default