Fork me on GitHub
#clojurescript
<
2016-06-16
>
rohit07:06:04

@kauko: That’s great. You may want to upvote on the ticket.

audaxion08:06:40

anyone have any good approaches to file uploads in cljs?

rd.sharma.x09:06:21

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

stathissideris09:06:51

@rd.sharma.x: clojurescript is single-threaded because javascript is. But you can make it look like you're doing async programming with core.async

rd.sharma.x09:06:39

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

plexus10:06:08

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?

mccraigmccraig10:06:38

@rd.sharma.x: it won't compile - the clojure functions which execute code on another thread (e.g. future) aren't there in clojurescript

rd.sharma.x10:06:12

@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

mccraigmccraig10:06:01

@rd.sharma.x: what are you wanting to do ? afaics the wasm execution model is also single threaded

rd.sharma.x10:06:48

@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

rauh10:06:13

@rd.sharma.x: Are you actually running in the browser? Or nodejs? Node can do use multiple cores IIRC

rd.sharma.x10:06:28

@rauh: node does not expose threads to developer code. we can write code over socket cluster

mccraigmccraig10:06:29

@rd.sharma.x: do you really care about threads ? you could run cljs on node on your pis...

rd.sharma.x10:06:49

@mccraigmccraig: I am looking for running the code on cores myself. also I do not want to use callback stack as means of concurrency.

octahedrion12:06:58

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

mfikes12:06:48

@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.

octahedrion12:06:04

that's my problem yes

octahedrion12:06:49

and I can't find what I need to modify in the (empty-state) to make it be able to resolve local bindings

octahedrion12:06:37

it's because I want users to be able to pass in expressions to evaluate that can refer to my app state

octahedrion12:06:42

like (fn [state sexp] (somethingsomething (cljs.js/eval compiler-state sexp... where sexp can say something like (get-in state...)

mfikes12:06:48

@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).

octahedrion12:06:46

@mfikes: ahhh now I know what to search for! thanks so much!

martinklepsch12:06:28

@plexus: have you checked git logs? I think browser repl is older than weasel. Most people likely use weasel because nrepl.

mfikes12:06:40

@octo221: I think Chris Ford’s Klangmeister project went down that road, FWIW. You might find good stuff in his repo.

dnolen12:06:46

@rd.sharma.x: JS VMs are generally single threaded so you just can’t accomplish what you want

dnolen12:06:23

WebWorkers are isolated, all you can do is various forms of message passing (string serialization), or transferring binary blobs in an unshared way

rd.sharma.x12:06:38

@dnolen: we can do that with wasm once it ships support for threads

dnolen12:06:45

none of these things are reasonable ways to implement Clojure concurrency constructs

dnolen12:06:59

@rd.sharma.x: if you target wasm, which isn’t implemented anywhere

rd.sharma.x12:06:12

@dnson: yes thats why i dont want to bring webworkers

dnolen12:06:21

there are lots of things about wasm that make it unattractive for most ClojureScript usage

dnolen12:06:38

we may investigate it at some point, but more likely someone else will have to supply the backend for it

plexus12:06:32

@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

rd.sharma.x12:06:48

@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 ?

dnolen12:06:08

@rd.sharma.x: I don’t know what you are asking

mfikes12:06:12

@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.

dnolen12:06:18

in theory sure, in reality probably not

rd.sharma.x12:06:38

@dnolen: agreed in theory

rd.sharma.x12:06:08

@dnolen: what I am looking to do is (functional program in clojure|scala|simplescript)->nodejs on raspberry-pis

dnolen12:06:03

@rd.sharma.x: ok - we have basic support for Node.js and people have targeted RPi before

rd.sharma.x12:06:36

@dnolen: kool. we can code distributed nodes but I am wondering if we can also do multi-threaded code ..

dnolen12:06:01

@rd.sharma.x: you’re on your own if you want to do multithreaded stuff like I said

dnolen12:06:11

and no plans in the near future to do anything about that

octahedrion12:06:12

@mfikes: wait why the need for the filesystem in that loader ? all the functions are already in memory

rd.sharma.x12:06:15

@dnolen: okies. will try 🙂

octahedrion12:06:19

oh because the compiler's going to compile the sources there & needs to ASTs in the compiler state

vikeri15:06:56

A question about comparing goog.date.DateTime: Since dates in javascript are a mess and I have to do a fair bit of data manipulation on dates I was thinking of replacing all uses of js/Date with goog.date.DateTime. The downside is that one can not compare DateTime: (sort [(goog.date.DateTime.) (goog.date.DateTime. 2015)]) does not work. Any suggestions on how to handle this?

vikeri15:06:14

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.

vikeri15:06:26

@rauh: Yes, I’m using that! But to my knowledge I can still not compare the datetime objects.

rauh15:06:21

What does (satisfies? IComparable a-date) give?

vikeri15:06:44

false 😔

rauh15:06:09

You have to require that namespace. @vikeri

vikeri15:06:01

Which namespace?

rauh15:06:42

The link I posted above, you said you're using that library?

rauh15:06:12

The docstring of that ns says it's optional ns, so you have to explictly require it

vikeri15:06:28

Oh sorry, I just saw the link to the library. My bad. Thanks!

zaffy15:06:49

I am looking to build a clj/cljs app with relational db using boot, figwheel, regeant etc. Any pointers?

zaffy15:06:48

me a newb to clojure world, been reading a lot but looking for a jumpstart

zaffy15:06:04

tried boot+tenzing and have the boilerplate app up with reload. Looking for a working sample with db and possibly auth

zaffy16:06:38

no takers I guess ...

dnolen16:06:13

@zaffy: there’s a #C0620C0C8 channel and a #C053K90BR channel you might want to try as well

dnolen16:06:23

the questions in this channel tend to be more general