top | item 17218195

(no title)

oreganoz | 7 years ago

Does Clojurescript support stuff like hot code reloading? And does Clojure have any good framework for an actor system implementation?

Because I've been interesting to get an excuse and try Clojure out and what you're saying is really interesting.

discuss

order

hellofunk|7 years ago

Clojure has its own very effective strategy for multi-threading, and it is not the actor model. The language is built for concurrency and much careful language design was tailor-made for the challenges on modern threaded applications. Rich Hickey investigated the actor model considerably, and decided on a different model. In the core language, you have the choice of using its normal futures/threads with highly efficient and lock-free data structures, or using core.async, which is a model like Go channels. The latter is particularly popular in the community and generally the recommended approach.

Clojurescript offered the first and still (in my opinion) best option for hot reloading via "figwheel" which nearly all Clojurescript developers use. It automatically updates the UI as you code it.

Clojure, on the server, being a proper lisp with a real REPL, lets you poke and inspect and reload parts of the running program with no recompile cycle. A typical workflow there is to reload individual expressions or functions in the context of the running program to alter behavior as you develop.

oreganoz|7 years ago

Yeah, that's nice for multi-threading but it does not seem as good for distributed systems. This is why I still don't know if I should invest in Clojure or Elixir.

Can the REPL on the server be used to update production systems with no downtime?

asragab|7 years ago

It does support hot-code reloading, the preeminent build tool for Clojurescript:

https://github.com/bhauman/lein-figwheel

has that out of the box. As for an actor model implementation, there is pulsar:

http://docs.paralleluniverse.co/pulsar/

Which has erlang-like actors, though some might suggest that core.async and its channel implementation provides everything you might need an actor for, YMMV.

oreganoz|7 years ago

Hmm, I guess I better look deeper into Clojure. Finally I get to play with a Lisp.

My main interest with actors is that these can be made to support hot code reloading on the server side. They also tend to be easily composable. Also also, they can be optimized by locality (eg. same-node, same-cluster, different-cluster)

I'm biased though, having not worked with CSP or other models.