This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # arachne (1)
- # beginners (27)
- # boot (17)
- # cider (10)
- # cljs-dev (5)
- # cljsrn (76)
- # clojure (59)
- # clojure-austin (2)
- # clojure-brasil (1)
- # clojure-greece (76)
- # clojure-mexico (1)
- # clojure-quebec (63)
- # clojure-russia (16)
- # clojure-spec (127)
- # clojure-uk (12)
- # clojurescript (72)
- # community-development (7)
- # core-async (3)
- # core-matrix (2)
- # cursive (13)
- # datomic (8)
- # emacs (4)
- # funcool (4)
- # hoplon (148)
- # immutant (5)
- # keechma (2)
- # lambdaisland (5)
- # lein-figwheel (15)
- # leiningen (20)
- # off-topic (23)
- # om (13)
- # om-next (19)
- # onyx (11)
- # planck (11)
- # re-frame (59)
- # reagent (14)
- # rum (34)
- # specter (30)
- # spirituality-ethics (16)
- # uncomplicate (5)
- # untangled (387)
- # yada (2)
hey guys... a noob here. I am wondering if its possible to do carry the concurrency of clojure to clojurescript. I am trying to get a solution to do distributed+concurrent programming on many raspberry-pi devices
There is a library there that abstracts webworkers in clojurescript. I was wondering if there was anything inbuilt. Also if I write a concurrent code in clojure and compile it to clojurescript what would happen. Again its all just theoretical for me. 🙂 thanks
am I correct in assuming that Weasel/Austin predate the browser-repl that ships with ClojureScript? Is there still a reason to prefer Weasel over the built-in repl?
@rd.sharma.x: it won't compile - the clojure functions which execute code on another thread (e.g.
future) aren't there in clojurescript
@mccraigmccraig: Great. Thats the answer I was looking for. Now what about compiling clojure to C++11 and then from C++11 to wasm ? would that allow to write concurrent code in clojure and run on a js vm. P.S. V8 has support for wasm today. Regards
@rd.sharma.x: what are you wanting to do ? afaics the wasm execution model is also single threaded
@mccraigmccraig: wasm will have threads after the mvp version is done. I am trying to get a solution to do distributed+concurrent programming on many raspberry-pi devices. For that I want to decide on a functional language and I am really inclined on clojure
@rd.sharma.x: Are you actually running in the browser? Or nodejs? Node can do use multiple cores IIRC
@rauh: on node
@rauh: node does not expose threads to developer code. we can write code over socket cluster
@rd.sharma.x: do you really care about threads ? you could run cljs on node on your pis...
@mccraigmccraig: I am looking for running the code on cores myself. also I do not want to use callback stack as means of concurrency.
oh oh! @mfikes how does one refer to local bindings in a cljs.js/eval ? i.e. vars bound outside the expression one is evaluating
@octo221: If the var is in the compiler state you should be OK. If you attempt to access a var that is not in the compiler metadata state (perhaps you are passing in empty state each time?) then you will run into issues.
that's my problem yes
and I can't find what I need to modify in the (empty-state) to make it be able to resolve local bindings
it's because I want users to be able to pass in expressions to evaluate that can refer to my app state
(fn [state sexp] (somethingsomething (cljs.js/eval compiler-state sexp... where sexp can say something like
@octo221: Normally you create an app state once and pass it in over and over again. (It is a mutable atom.) If you have app state that was built up outside of bootstrap (vars and such that were setup outside of
cljs.js/eval there are ways of dealing with this as well, but it amounts to loading in compiler metadata cache).
@mfikes: ahhh now I know what to search for! thanks so much!
@plexus: have you checked git logs? I think browser repl is older than weasel. Most people likely use weasel because nrepl.
@octo221: I think Chris Ford’s Klangmeister project went down that road, FWIW. You might find good stuff in his repo.
@rd.sharma.x: JS VMs are generally single threaded so you just can’t accomplish what you want
WebWorkers are isolated, all you can do is various forms of message passing (string serialization), or transferring binary blobs in an unshared way
@dnolen: we can do that with wasm once it ships support for threads
@rd.sharma.x: if you target wasm, which isn’t implemented anywhere
@dnson: yes thats why i dont want to bring webworkers
there are lots of things about wasm that make it unattractive for most ClojureScript usage
we may investigate it at some point, but more likely someone else will have to supply the backend for it
@mfikes: ahah https://github.com/ctford/klangmeister/blob/master/src/klangmeister/compile/eval.cljs#L63
@martinklepsch: yeah I've realized that in the meanwhile. My limited understanding so far is that Piggieback came first to combine the built-in REPL with nREPL, then Austin came to replace the built-in REPL with a better (?) repl while being piggieback compatible, then Weasel came and did mostly what Austin does, but with websockets
@dnolen: If we can do concurrent programming using jvm then would it not make a good thing to do it on other hosts as well ?
@rd.sharma.x: I don’t know what you are asking
@octo221: Yes. IIRC the big picture there is you can evaluate ClojureScript in the browser window which in turn refers to vars that are in the Klangmeister namespaces.
@dnolen: agreed in theory
@dnolen: what I am looking to do is (functional program in clojure|scala|simplescript)->nodejs on raspberry-pis
@rd.sharma.x: ok - we have basic support for Node.js and people have targeted RPi before
@dnolen: kool. we can code distributed nodes but I am wondering if we can also do multi-threaded code ..
@rd.sharma.x: you’re on your own if you want to do multithreaded stuff like I said
@mfikes: wait why the need for the filesystem in that loader ? all the functions are already in memory
@dnolen: okies. will try 🙂
oh because the compiler's going to compile the sources there & needs to ASTs in the compiler state
A question about comparing
goog.date.DateTime. The downside is that one can not compare
(sort [(goog.date.DateTime.) (goog.date.DateTime. 2015)]) does not work. Any suggestions on how to handle this?
I know I could implement my own comparator, but is that really the best solution, givet that
js/Date comparisons is handled out of the box.
@rauh: Yes, I’m using that! But to my knowledge I can still not compare the datetime objects.
I am looking to build a clj/cljs app with relational db using boot, figwheel, regeant etc. Any pointers?
tried boot+tenzing and have the boilerplate app up with reload. Looking for a working sample with db and possibly auth
@zaffy: there’s a #C0620C0C8 channel and a #C053K90BR channel you might want to try as well