r/Clojure • • Aug 10 '17

Clojerl - Clojure for the Erlang VM

https://github.com/jfacorro/clojerl
78 Upvotes

20 comments sorted by

7

u/dustingetz Aug 10 '17

Related to this, Paul Snyder gave a talk in Philly last night about a clojure library Pulsar https://github.com/puniverse/pulsar which brings Erlang-like actor primitives to clojure, it works by scanning your jar file and rewriting jvm bytecode http://blog.paralleluniverse.co/2013/05/02/quasar-pulsar/

2

u/zachncst Aug 11 '17

Is Pulsar still actively developed on? Last published release was from a year ago. Parallel Universe has just been awfully quiet recently.

1

u/Venthorn Aug 11 '17

I know they were waiting for something coming in jdk9 which at least is finally (almost) here.

0

u/[deleted] Aug 10 '17

[deleted]

5

u/zcam Aug 11 '17 edited Aug 11 '17

I'd argue the opposite, I don't think it's possible on the JVM to achieve the level of customization the gc/memory model Beam has for actors. Which is fine, sometimes one way is better than the other and vis-versa. It's also likely one of the reason why Rich choose to add a CSP based library + agents & co and not actors on the clojure side of things.

3

u/halgari Aug 11 '17

Pretty much. With actors you have to manually track backpressure and message tagging. With channels you get backpressure out-of-the-box and since you have alts! you can easily listen to multiple channels and know which channel received the message.

3

u/flaheadle Aug 12 '17

And what do you do if your go block throws an error?

2

u/halgari Aug 13 '17

Same thing as with actors or any process. Let it die (or don't) really depends on the situation. Like actors, CSP doesn't force you into a error handling methodology.

1

u/zcam Aug 11 '17

I was more thinking about low level stuff, like per process stack/heap/gc, preemptive scheduling etc. But yes the underlying platform "forces" one model or the other to the language on top of it. I personally don't have a preference, both ways have their pro/cons, and it's very situation specific what to use or not.

3

u/chepprey Aug 11 '17

I'm curious to see a detailed list of language constructs and features that are and aren't supported.

1

u/jfacorro Aug 17 '17

There is an attempt at something of the sort in the Differences from Clojure, but I agree a list of currently available and missing features is missing, I will create a ticket for that. Something that is not mentioned in that document for example is the possibility of using Erlang pattern matching (including guards) in some of the language constructs (let*, receive*, fn*, case*).

2

u/SlowMovingTarget Aug 12 '17

Missed ClojureBeam by that much.

1

u/sbensu Aug 11 '17

I tried it and it is much more advanced that one would expect. Try it, you'll be pleasantly surprised!

1

u/zcam Aug 11 '17

Impressive work, kudos

1

u/[deleted] Aug 11 '17

More power to your elbow jfacorro.

1

u/doctork91 Aug 11 '17

I don't know Erlang so I can't comment on anything meaningful, but the name seems ambiguous. My first thought was that it was some kind of clojure-perl hybrid. Erljure seems like a less ambiguous, if uglier name.

1

u/sbensu Aug 12 '17

Another, easier to pronounce, option is ClojureBeam but not many people know that the Erlang VM is called the BEAM.

1

u/doubleagent03 Aug 15 '17

Not supporting all Clojure features

So...no concurrency primitives like atoms, agents, and refs?

1

u/zcam Aug 17 '17

In theory it s feasible to build something that would feel like it on beam (on ETS for instance), but it doesn't fit with the platform capabilities really. An elixir like lisp with nice flow/composition utils and protocols, macros etc is already quite nice. I think not aiming for feature parity is a necessity here. On the other hand you get access to all the otp features "for free".

1

u/doubleagent03 Aug 17 '17

Well...at a glance it looks like a solid implementation, so kudos.

1

u/jfacorro Aug 17 '17

There are some thoughts about that here along with some others points that may be interesting as well.