This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-16
Channels
- # announcements (3)
- # babashka (48)
- # beginners (35)
- # calva (3)
- # chlorine-clover (5)
- # clj-kondo (9)
- # cljdoc (20)
- # cljsrn (1)
- # clojure (55)
- # clojure-europe (33)
- # clojure-nl (3)
- # clojure-norway (6)
- # clojure-spec (7)
- # clojure-uk (27)
- # clojurescript (95)
- # closh (1)
- # conjure (1)
- # cursive (16)
- # datomic (30)
- # emacs (7)
- # honeysql (1)
- # hugsql (2)
- # introduce-yourself (2)
- # jobs (1)
- # lsp (30)
- # malli (22)
- # nbb (11)
- # news-and-articles (1)
- # off-topic (8)
- # pathom (21)
- # polylith (39)
- # portal (4)
- # practicalli (4)
- # protojure (1)
- # re-frame (14)
- # releases (1)
- # restql (1)
- # reveal (24)
- # sci (1)
- # sql (21)
- # vim (11)
- # xtdb (33)
Guys, hello! I got a little problem with cljs. I have a local/root dependency in my deps.edn. It works without any problems with shadow-clj, When I add the same dependency to deps.edn in figwheel project it crashes with the following stacktrace: https://paste.ofcode.org/3aTVdbtMzV3A6MC2vUdxcQ6 Does anyone have some ideas?
I want to write a test around flush-on-newline for SCI. First I want to make sure the behavior of the test works in CLJS itself:
(let [count-atm (atom 0)]
(with-redefs [cljs.core/flush #(swap! count-atm inc)]
(binding [*flush-on-newline* true]
(prn) (prn)) #_(sci/eval-string (pr-str '(binding [*flush-on-newline* true]
(prn) (prn)))))
(prn @count-atm))
But when running this, @count-atm
still yields 0. It seems the with-redefs
doesn't really work. Any ideas?I actually don't care that it's not supported, I just cared about compatibility of SCI <-> CLJS, so all good.
but it seems we can safely remove this: https://github.com/clojure/clojurescript/blob/29363bbd1d34bb2aeb7b4d762ee4f4ba2f173ddf/src/main/cljs/cljs/core.cljs#L10382
the cost of a map look on something that's supposed to be I/O bound is not something to spend time on 🙂
either way is fine with me. I think it could be a minor win, if the code was removed, that at least it wouldn't confuse people as much as it did me
I have a function with this line code: (js/Number.isFinite value)
When I try to perform some unit tests on this function (using cljs.test
) I get the error TypeError TypeError: 'undefined' is not a function (evaluating 'Number.isFinite(G__47385_47386)')
Do native JS functions run on the testing environment?
@borkdude that's why I suggested fixing the docstring / adding a couple of comments about the state - I agree it's confusing when you start to look at it - and I didn't remember either
@rinam https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite - it's been around for a while now - but always possible it's not available in the JS environment you are using
When I run the function that used js/Number.isFinite
the code works as expected.
But when I perform the unit tests on this function I get the error TypeError TypeError: 'undefined' is not a function (evaluating 'Number.isFinite(G__47385_47386)')
@rinam does that mean your testing environment is the same as your program environment?
Maybe the term environment is wrong. I'll try to make it more simple. I have a foo function
(defn foo [volume]
(if (js/Number.isFinite volume)
volume
0))
When I run this code using the repl it works as expected.
When I wrote unit tests for this function and ran the tests there is an error TypeError TypeError: 'undefined' is not a function (evaluating 'Number.isFinite(G__47385_47386)')
.
Is that clear?it's probably not turnkey - but there should be examples in the wild about how to use it for testing
Are there people working with Web Components with ClojureScript or is it mostly used for React through Reagent?
you can use Web Components from JS - so that means you can use Web Components w/ ClojureScript
yes ClojureScript makes it easy to do - but it is not a requirement - many contexts still exist where that property might not be interesting
sure. I didn't take the question to be, "can we develop web components with ClojureScript?" but rather, "is this path well paved?" which I would say the web components + clojurescript DX is not well paved at all compared to using something like React. that's just a function of how much time, money, and people are trying to do that.
just pointing out the baseline - if you can do it JS then you can do it in ClojureScript
and plenty of things exist now to make it frictionless (no externs, Webpack etc. works) - and the REPL still there
IIRC it requires that special behavior w/ calling super()
in the constructor that can't be shimmed via prototypes
https://github.com/WICG/webcomponents/issues/587#issuecomment-737139676 seems to claim different?
but I guess this is a problem - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields