clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Karol Wรณjcik 2020-10-27T08:34:29.299100Z

How can I add data_readers to codox?

victorb 2020-10-27T10:47:04.299500Z

Sorry for the delay. Yeah, either that or store the request in your app-state that you're using for re-frame

uosl 2020-10-27T11:24:40.300400Z

(let [top (some-> (gdom/getElement id)
                          (ocall :getBoundingClientRect)
                          (oget :top))]
          (if (and (number? top) (pos? top))
Isn't this valid code? Figwheel is giving me a warning pointing at pos? cljs.core/>, all arguments must be numbers, got [#{nil clj-nil} number] instead.

dnolen 2020-10-27T13:08:38.301800Z

ClojureScript cannot infer that

dnolen 2020-10-27T13:09:05.302100Z

you can type hint top to make it go away

1๐ŸŽ‰
dnolen 2020-10-27T13:09:56.302700Z

(number? ...) should propagate it but there's still issues here

Flo 2020-10-27T13:16:00.303200Z

QQ: Does clojurescript not have future?

dnolen 2020-10-27T13:21:35.304300Z

@web20 no

Flo 2020-10-27T13:22:11.304500Z

thanks! curious, is there a technical reason for this?

victorb 2020-10-27T13:37:06.304700Z

There is js/Promise in JS world

2020-10-27T13:43:58.304900Z

@web20 I am not a ClojureScript expert, but at least in Clojure/Java future creates a separate thread. JavaScript runtimes have only one thread, and cannot create others.

Flo 2020-10-27T13:47:36.305100Z

@andy.fingerhut That's true, I thought there might be a js-native solution to mimic future's behaviour on cljs

2020-10-27T13:48:08.305400Z

Without multiple threads, the best I can imagine is just calling a function and blocking until you get the return value back.

victorb 2020-10-27T13:48:08.305600Z

might make sense to have a future-in-webworker function that can execute the form in a web worker or similar

victorb 2020-10-27T13:48:18.305800Z

(for browser contexts at least)

2020-10-27T13:48:43.306Z

yes, technically webworkers do allow multiple execution threads, but without shared memory between them the way Clojure/Java has.

1โž•
dnolen 2020-10-27T13:51:13.306500Z

the problem with doing anything with future is the deref is blocking

dnolen 2020-10-27T13:51:35.307Z

in Clojure - you cannot replicate that in JavaScript - which destroys any portability benefits

kah0ona 2020-10-27T14:03:40.308300Z

When I miss an extern, somehow, I get ie. Uncaught TypeError: http://ZR.Lc is undefined How can I debug what is missing? Is that even possible from the compressed output?

pesterhazy 2020-10-27T14:20:33.308700Z

@kah0ona look for the "pseudo-names" compiler option

kah0ona 2020-10-27T14:45:48.309200Z

thanks @pesterhazy

gomosdg 2020-10-27T20:49:16.313800Z

Hi everyone, For some reason I am getting these warnings when source-maps are enabled. I am using shadow-cljs. I may have configured it funny. Please help.

2020-10-27T20:50:53.314100Z

Open one of those .map urls in a separate browser window and look in devtools how does the response look like

2020-10-27T20:51:13.314300Z

from the error it looks like your server is not serving a JSON file, but HTML instead

2020-10-27T20:51:25.314500Z

probably with some error page

gomosdg 2020-10-27T20:58:29.314700Z

Hi @darwin, the files seem to be empty.

2020-10-27T20:59:02.315Z

look at the source of the files, the warning clearly reports that they start with โ€œ<โ€

gomosdg 2020-10-27T20:59:42.315200Z

Oooh... I see what's up. The server is always serving the index.html page.

gomosdg 2020-10-27T21:01:42.315400Z

I think I still need to get my head around :asset-path vs :output-dir vs :http-root

gomosdg 2020-10-27T21:06:51.315600Z

Corrected my :asset-path config and it works. Thanks, @darwin!

1๐Ÿ‘