This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-08
Channels
- # 100-days-of-code (1)
- # admin-announcements (1)
- # aleph (1)
- # announcements (9)
- # beginners (125)
- # cider (1)
- # cljs-dev (80)
- # cljsrn (2)
- # clojure (82)
- # clojure-czech (1)
- # clojure-dev (5)
- # clojure-finland (1)
- # clojure-italy (16)
- # clojure-nl (6)
- # clojure-spec (24)
- # clojure-uk (39)
- # clojurescript (35)
- # community-development (49)
- # core-async (3)
- # cursive (31)
- # data-science (17)
- # datomic (21)
- # emacs (5)
- # fulcro (92)
- # graphql (1)
- # jobs (2)
- # lambdaisland (1)
- # leiningen (19)
- # luminus (9)
- # off-topic (21)
- # parinfer (6)
- # pedestal (1)
- # portkey (2)
- # re-frame (12)
- # reagent (8)
- # reitit (4)
- # shadow-cljs (117)
- # spacemacs (5)
- # specter (4)
- # sql (2)
- # testing (2)
- # tools-deps (3)
- # vim (1)
I'm exploring the capabilities of a standalone cljs compiler through cljs.main. I wrote a simple script like this:
bash
clj --main cljs.main --compile demo.core --repl --repl-opts repl.edn
And the contents of repl.edn
are like this:
clojure
{:watch "src"
:watch-fn (fn [] (.alert js/window 1))}
Do I understand correctly that I should see an alert in the browser window every time my code got recompiled?@achikin no. I'm pretty sure you can't specify :watch-fn
via deps.edn
at all since its not evaluated
It's not in deps.edn
. I'm passing it as repl options via --repl-opts
key to cljs.main
as described here https://clojurescript.org/reference/repl-and-main#_cljs_main_help
the .edn
file is just data and not evaluated as code so :watch-fn
only works when running via cljs.build.api
directly and not cljs.main
it is also run on the Clojure side to call a Clojure function when the build completes
Thank you for clarifying. I was trying to set up some basic hot reload using only cljs.main
(without shadow or figwheel). Seems like it's not possible...
I'm seeing an analysis issue in cljdoc that only occurs with ClojureScript:
Unable to resolve var: *runtime-asserts* in this context
The stacktrace refers to a line calling spec/assert
which uses *runtime-asserts*
:
https://github.com/clojure/clojurescript/blob/39f47c3b840815d338b27bd864fb33115e73c24a/src/main/cljs/cljs/spec/alpha.cljc#L556
weirdly *runtime-asserts*
is never defined anywhere. :thinking_face:ah, nevermind, it's defined in the .cljs
file.
Still not sure how that causes an exception here: https://circleci.com/gh/martinklepsch/cljdoc-builder/6786
@U050TNB9F Hey, Orchestra may need to be updated for that version of Clojure/ClojureScript. Spec just changed a lot recently, so let me check on it this weekend and maybe rebase. Are you able to make a minimal repro case so I can verify any fixes?
@U4986ECDQ it's not a minimal repro in any way but it should help with verifying a fix:
1. git clone
2. ./script/analyze.sh orchestra 2018.11.07-1
You can replace the jar and pom paths with something that is local on your disk too.
Let me know if you can't find the issue easily (e.g. if it seems unrelated to recent changes) and I'll try to come up with a smaller repro case.
@U4986ECDQ fairly confident this is a compiler regression so feel free to not spend any time on this 🙂
@U050TNB9F Ok, cool. I haven't looked into it yet, so maybe I'll hold off until we're more sure about it.
Are any work arounds to having a promise in cljs? (the Clojure definition of a promise, not the es6 one)
well you can access the full JVM including everything in java.util.concurrent
and clojure.lang
(you can't block in JS so a blocking deref is not possible no matter which way you try)
@pablore https://github.com/funcool/promesa has async/await macros that give you the equivalent of the JS async/await, which will let you unwrap promises from within an async function - it uses state machine code along similar lines to what go blocks do in core.async (or similar to how async/await works in JS, incidentally). Essentially pausing the async function until the promise is resolved
@jesse.wertheim that library look very cool, but it doesn’t has the same api as Clojure’s promises. I can’t deliver values to them which is what I want
yeah, all you can do in cljs is fake it within the context of a state machine, since JS uses a single-threaded event loop and can't block
I've been getting some warnings when I build my project. This happens when making an uberjar with advanced compilation and when using lein figwheel:
Everything appears to work fine, though. Are these warnings noteworthy in any way?
I'm using Clojure 10.10.0-beta5
and Clojurescript 1.10.439
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead at line 117 target/cljsbuild/public/js/cljs/tools/reader/edn.cljs
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead at line 117 target/cljsbuild/public/js/cljs/tools/reader/edn.cljs
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead at line 118 target/cljsbuild/public/js/cljs/tools/reader/edn.cljs
WARNING: cljs.core/bit-or, all arguments must be numbers, got [string number] instead at line 118 target/cljsbuild/public/js/cljs/tools/reader/edn.cljs
@pablore oh wait, do you mean the semantics of (def foo (promise))
and (deliver foo some-value)
? because this you can do with a little interop wrapping
@vheuken You probably want the version of tools.reader with https://github.com/clojure/tools.reader/commit/c5421fd8809784ef893e2afaf0d8996229864908