This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-24
Channels
- # announcements (5)
- # aws (24)
- # babashka (41)
- # beginners (130)
- # bristol-clojurians (2)
- # calva (39)
- # chlorine-clover (64)
- # cider (30)
- # clojure (202)
- # clojure-belgium (1)
- # clojure-dev (99)
- # clojure-europe (5)
- # clojure-hungary (4)
- # clojure-italy (10)
- # clojure-losangeles (8)
- # clojure-nl (11)
- # clojure-norway (6)
- # clojure-spec (7)
- # clojure-uk (12)
- # clojurescript (52)
- # core-typed (26)
- # cursive (19)
- # data-science (19)
- # datomic (19)
- # duct (10)
- # emacs (17)
- # fulcro (22)
- # graalvm (11)
- # jobs (3)
- # kaocha (28)
- # leiningen (6)
- # lumo (2)
- # malli (10)
- # nrepl (2)
- # off-topic (23)
- # pathom (2)
- # pedestal (7)
- # re-frame (3)
- # reagent (30)
- # reitit (2)
- # remote-jobs (2)
- # shadow-cljs (77)
- # sql (10)
- # test-check (22)
- # tools-deps (37)
- # vscode (1)
- # yada (3)
i'm pretty sure there's a way to have a in-browser repl (e.g. in a popup window , with some limited backward scrolling ability) , to use with a in-browser clojurescript app .. but i'm having difficulties finding one... any good suggestions ?
(def name (reagent.ratom/atom "Bear"))
(defn ask-for-forgiveness
[] ;; <--- no props
[:div "Please " @name " with me"]) ;; notice that @
How does reagent knows which function to re-render when the depending ratom changes ?
Hello! who has an ide why this custom CLJS reader does'n work for me:
(ns ok.ok)
;; #js-object-record
(defrecord JsObjectRecord
[type data-map])
(defn js-obj-read-fn [arg]
(println "reading function-----" arg (type arg)))
(cljs.reader/register-tag-parser! 'ok.ok/JsObjectRecord js-obj-read-fn)
(cljs.reader/read-string "#ok.ok/JsObjectRecord [1 2]")
(println (cljs.reader/read-string "#ok.ok/JsObjectRecord [1 2]"))
I am having : "No reader function for tag ok.ok/JsObjectRecord."
actually this is the solution
Huh. I'm trying it in my own namespace and it fails with No dispatch macro for h.
. h
is the first character in that namespace.
Yeah, I did use the symbol version. But it seems that a tag parser cannot return nil
.
If I return nil
it thinks that that's not a tag and tries to parse it as a dispatch macro.
I use [org.clojure/clojurescript "1.10.597"]
and for example this code works:
(cljs.reader/register-tag-parser! 'foo identity)
(cljs.reader/read-string "#foo [1 2]")
but for some reason when I namespace the symbols it stops, even if the namespace is already present (I created one just for the sample)
I just found out that the reading function is the problem - when I use identity it all works, but any function made by me drops that exception
(defn js-obj-read-fn [arg] (println "reading function-----" arg (type arg)) arg)
and still the same error
does this (cljs.reader/register-tag-parser! "jsc" js-obj-read-fn)
return anything?
I restarted the REPL and it works now....
Heh, yeah, that happens. I usually work within web pages, and I tend to just reload the page when something strange is going on.
hey people!! has anyone ever managed to play with cordova + cljs please ? I would be interested in some documentation on how to get them to work together!thanks in adv
the translation of foo.init().then(function(z) { z });
would be (.then (.init foo) (fn [z] z))
right?
yep. Apparently the api returns some other thing that isn't a promise if you don't tell it to. A "librarly specific object". cool.
I am trying to have some calculations work out exactly the same between Clojure and Clojurescript, and the different implementations of numbers are biting me. Are there any libraries or quick fixes for this? Otherwise my first thought is to make my own 'Ratio' type and math functions to use cross-platform.
I recently watched a video by Tony Kay where he uses big.js
to help bridge the gap between big decimals in Clj/Cljs. It’s around the 11 minute mark in this video (I think...on mobile currently)
https://youtu.be/euwuLyzMDVg
I feel like that question is going to be a rabbit hole 🙂
If it makes thinks any better, I don't have to mess with how numbers work everywhere they might be used in clojurescript, just in a limited 'scripting' scope I have total control of.
I have been avoiding this one for months, but my internal users are not satisfied with my 'just use integers' solution
I guess they wouldn't be satisfied with a 'just use doubles' solution, either, which I think is what some JavaScript engines default to.
Often told JS isn’t multithreaded, but is anyone looking at bringing more over into CLJS utilizing Worker threads?
in the shadow-cljs UI I moved all data processing to a worker and the "main" thread just queries it like a db. works ok but the tradeoffs are kinda annoying
Once I made a game where I tried moving the physics to a webworker, but it cut FPS from 60 to 20. Having to serialize everything all the time means it is useless for a lot (maybe even most) use cases.
will be cool if workers + wasm threads get to some point where we could pass immutable objects without serializing
I don’t know much but my first thought is that will always be impossible to do without coordinating with the main thread
well for example on other platforms, it is not problem to measure the size of a text with a certain font on a background thread. No reason one shouldn't be able to do the same in a web worker. I could see limiting which thread can modify the DOM, but what about DOM objects that are just in memory, not rendered on screen?
Is this something not shared on the browser? > Unlike child_process or cluster, worker_threads can share memory. They do so by transferring ArrayBuffer instances or sharing SharedArrayBuffer instances.
AFAICT SharedArrayBuffer is caught in limbo right now and isn’t supported by many browsers