6 ms·
That’s very cool. I’ve added Clojerl to my list of alternative languages on the BEAM: https://gist.github.com/macintux/6349828#alternative-languages-targeting-t
by macintux 7y ago
That’s very cool. I’ve added Clojerl to my list of alternative languages on the BEAM: https://gist.github.com/macintux/6349828#alternative-languages-targeting-the-erlang-vm https://gist.github.com/macintux/6349828#alternative-languag...
Given the extent to which the Erlang VM is optimized for immutable data, network transparency, and message passing, I can see why Clojure on the JVM and CLR would not have had the same success with the actor model as Erlang has.
- jacobush 7y agoI don’t ...
- macintux 7y agoThe JVM is a kitchen sink environment. The BEAM is very opinionated. I would expect the VM built from the ground up to support a specific programming model to be superior at doing just that.
- macintux 7y agoIn addition, every library written for the BEAM in any language is designed for message passing and the actor model. Clojure would not have that advantage on the JVM.
- didibus 7y agoClojure doesn't use the actor model...
- macintux 7y agoWhich was part of the discussion at the linked article.
- didibus 7y agoOh okay, sorry I misunderstood your comment the first time. The rationale for why Rich Hickey didn't go for the actor model are actually documented here: https://clojure.org/about/state https://clojure.org/about/state I agree with you, that the JVM also would have probably made it more difficult to incorporate and leverage, though Scala seems to have pretty successfully done that, and Fantom has gone that route as well successfully (though the language is niche) on the JVM. So I'm not totally sure either.
- pron 7y agoBEAM is a wonderful VM, but calling it "optimized" for anything is problematic. It has focused on certain use cases, but it's seen less than 1% of the investment in the JDK, so I guess it's better to call it "specialized". While it works well enough for many things, its performance is like the JVM limping on both legs after a terrible car accident and a bad case of pneumonia while trying to walk on an icy road. You are correct, though, that it probably performs better than a general-purpose platform with a similar level of investment.
- nivertech 7y agoBTW, many years ago, the author of Erjang told me that eventually Erjang will be faster than BEAM for running Erlang apps, b/c of all the investment that went into the JVM ecosystem. I'm not sure it's the case now (probably since nobody using Erjang in production). You are correct in describing the raw performance of BEAM, but I'm not sure it's relevant for a typical IO-bound Erlang/Elixir app. Also most large real-life apps would use NIFs written in a language capable generating native code, i.e. C/C++ or Rust.
- patrec 7y agoThere is no doubt that JVM can provide massively better performance for a lot of stuff, but I wouldn't be suprised if Beam kicked JVM's butt in at least some areas. It's pretty much the only system I know of that provides for massive numbers of fairly scheduled, preemptive green threads. To do so it makes trade-offs that are not generally attractive, but I'd be surprised if it didn't beat the JVM here.
- pron 7y agoI would be. BEAM is just a very slow platform, not just compared to Java, but also compared to JavaScript and Go. Again, that's not to say it's not very useful for some things (although many Erlang apps are really mixed Erlang/C apps because of BEAM's performance). Hey, CPython is really slow, too and yet very useful. Green threads is another matter as it's not a feature that currently exists on the Java platform (there are somewhat similar features in Java platform languages like Kotlin's coroutines), but there is currently a project (that I'm leading) to add fibers (AKA user-mode threads, AKA lightweight threads, AKA green threads) to the JVM: https://wiki.openjdk.java.net/display/loom/ https://wiki.openjdk.java.net/display/loom/
- fulafel 7y agoBenchmarking Clojure (both JVM and JS) vs Erlang immutable data structures would be very interesting given the focus on clever implemeations (persistent data structures) on the Clojure side and the VM level specialization on the Erlang side.
- sbuttgereit 7y agoI like your list, but one thing that would be helpful for me is in the alternative languages available on the BEAM, make the distinction between those implementations which are "BEAM languages" vs those that are simply implemented on the BEAM. For example, Elixir is a proper BEAM language that targets the BEAM directly in a compile step.... but Luerl is not: Luerl is basically a Lua interpreter written in Erlang. I would expect different trade-offs from Elixir vs. Luerl as such. For example, I have a project where I need a limited, embedded scripting environment inside of an otherwise Elixir project. Using a BEAM language seems to be difficult to impose the desired limitations for such scripting environment, but in Luerl it seems I can do just that... limiting the scripting to a-less-than-system-wide scope. Of course... I expect a fairly substantial performance penalty for that... but trade-offs :-).
- macintux 7y agoI think if I were running this as a repo with the possibility of pull requests I’d get more granular, but I can rarely be bothered to do much more than occasionally add a link. To be pedantic, btw, Elixir compiles to Erlang Abstract Format, not the BEAM itself.
- yellowapple 7y ago> I’ve added Clojerl to my list of alternative languages on the BEAM Nice! As a bit of a shameless plug, I have an entry for your list: https://otpcl.github.io/ https://otpcl.github.io/ (GitHub repo: https://github.com/otpcl/otpcl https://github.com/otpcl/otpcl)