This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-04
Channels
- # announcements (1)
- # architecture (18)
- # aws (7)
- # babashka (63)
- # beginners (38)
- # bristol-clojurians (1)
- # circleci (1)
- # clj-kondo (10)
- # clojars (4)
- # clojure (159)
- # clojure-berlin (3)
- # clojure-europe (4)
- # clojure-italy (7)
- # clojure-losangeles (6)
- # clojure-nl (7)
- # clojure-spec (3)
- # clojure-uk (109)
- # clojurescript (54)
- # css (1)
- # cursive (38)
- # data-science (2)
- # datascript (3)
- # datomic (14)
- # docker (2)
- # duct (11)
- # fulcro (47)
- # jobs (8)
- # jobs-discuss (3)
- # kaocha (4)
- # malli (3)
- # nyc (2)
- # off-topic (30)
- # overtone (3)
- # re-frame (17)
- # reagent (33)
- # shadow-cljs (29)
- # spacemacs (3)
- # specter (4)
- # tools-deps (13)
- # xtdb (13)
According to https://www.clojurescript.org/about/differences, cljs.spec and cljs.test are ports of their respective clojure namespaces.
But I’ve got some cljs tests that require the clojure namspaces (not the cljs namespaces) and everything seems to run just fine.
Is there a reason to prefer requiring cljs.spec and cljs.test in cljs tests or does it not really matter?
since so many libs relied on clojure.core
clojure.test
etc., they implemented special handling of it in the compiler to rewrite clojure.*
to cljs.*
When using Cljsbuild with whitespace optimization this worked fine (.-addr (.-dataset e)
where addr is a custom attribute. Then when setting optimization to advanced, I am getting nil. Any idea whats going on?
If you're using shadow-cljs, you should be able to write (.-addr ^js (.-dataset ^js e))
.
you need a faq page to just point to that @dnolen :) (like https://clojure.org/guides/faq)
@mario.cordova.862 under advanced compilation property access will get renamed - that's why it doesn't work and should be avoided - (unless it's JS language properties or mature standard browser APIs)
@david_clojurians we auto-alias clojure.foo -> cljs.foo - it helps with portability (i.e. cljc files) - it's intentional so feel free to use that feature as you see fit
@posobin you can trivially await promises w/ core.async - there's a patch to add support to core.async directly that I need to review once more
Sorry, how?
core.async go blocks support async/await style syntax via the blocking operators <!
>!
etc.
But this way it is harder to deal with exceptions, no?
but sure I expect the debug support for async/await to be pretty good since there's native support
is there a way to preprocess some files before compilation like converting svgs to hiccup components?
Yes, write a macro that reads a file, transforms SVG string into hiccup and expands into a component definition
What's wrong with that?
hmm i am missing something here - the GCC won’t complain having a clojure primitive inside a clojure script file?
Macros are written in clj files, then when called in cljs files they are running at compile time. So you can read a file and transform contents at compile time and return hiccup which will be then compiled to js. I'd recommend to read more about macros in Clojure and ClojureScript.
Yeah macros in ClojureScript are awesome. You have access to the entire Clojure ecosystem and the file system so you can go crazy :)
Has anyone had any luck getting a react async select to work in cljs? the callback/promise on loadOptions is throwin me off
I suppose the root of the issue is- anyone have any tips for interop that requires a promise / callback? Do I use a go block?
Perhaps I'm confused at a lower level of understanding. I'll look into using a promise directly
@shanelester55 Here's a script which uses promises directly: https://gist.github.com/yogthos/d9d2324016f62d151c9843bdac3c0f23#file-gallery-cljs. Maybe the example is useful to you.
Ahh thank you!
Boy, this is perplexing. I got an error f.call is not a function
, stack trace indicates that it was happening in clj->js
. Ok, I’ve got some values that I’m passing to clj->js
, I’ll pprint them and see what the problem is. Now I’ve got f.call is not a function
in pprint
. Ok, printing doesn’t work, I wonder what the types are for those values? So I try (doseq [v values] (pprint {:type (type v)}))
. Now I’ve got f.call is not a function
in Object.cljs$core$accumulating_seq_count.
What the heck have I got in my data that’s making everything blow up like that??
(Apparently that last one may be happening in a call to seq
or count
. Or both.)
@manutter51 do you have a lazy seq in that data? that'll make things look weird sometimes
Ah, yes, I do, thanks for the clue, that wouldn’t have occurred to me
Oh word, I accidentally had the arguments to remove
in the wrong order. What a wild way for that bug to show up!
Tks much @thheller I’d have been all afternoon on this one. 😉
I'm looking for a good reference for how to evaluate CJLS expressions in the browser. Goal being allowing users to define functions (like defining a formula in an excel spreadsheet).
that’s probably not very good reference for a beginner, but you can hopefully google more articles about self-hosting clojurescript compiler in your app
ah, sorry, now looking at the link you posted below and it is about self-hosted compiler, so you already found it 🙂
If you want a real example of this that is quite self contained, have a look at Saite https://github.com/jsa-aerial/saite. Specifically the analyzer.clj
and compiler.cljs
under the src/cljs/aerial/saite
dir.
Also, the codemirror.cljs
shows how this is used interactively. If you want to see it all in action, grab the uberjar https://github.com/jsa-aerial/saite#uberjar and just start hacking!
Thanks. Seems like i should consider an interpreter too. https://github.com/borkdude/sci looks interesting.
I found this article dated 2015. Is it a good approach or have things moved on? https://yogthos.net/posts/2015-11-12-ClojureScript-Eval.html