3 ms·
Is Scala Really the Next C++?
- KirinDave 18y agoWhy wouldn't Erlang be the next C++? Erlang's fast, compiled, but still flexible and dynamically, strongly typed. It has a type inference engine so you can look over your code, and it's fairly easy to do IDE integration with Erlang. Erlang's distribution and multi-threading primitives are unbelievably well tested, and everyone could learn a thing or two from the OTP model. I can't imagine why we'd ever consider Scala over Erlang.
- dalice 18y agoCause Erlang is a point solution that is totally painful outside of its target domain and has practically no library support.
- yariv 18y agoYou can call Java (or Python, Ruby, C etc) libraries from Erlang if you really have to. I'd bet Erlang's libraries would be quite sufficient for a wide range of apps, though. Where did you run into pain trying to use Erlang outside of telcom apps? Just curious...
- mikkom 18y agoAlso remember where java started (oak) - a much more point solution than what erlang has ever been.
- astrec 18y agoYa know, when I first this comment on library support I thought "Well kinda..." but after a couple of hours mulling it over not so much. Erlang has a pretty good set of standard libraries, and whatever missing is relatively easy to build yourself, by comparison. Granted, there are some very good OS Java libraries, but there's also an awful lot of drivel - one need only fire up their profiler to verify it. I'd say you're being quite uncharitable to Erlang.
- astrec 18y ago"I can't imagine why we'd ever consider Scala over Erlang." Primarily because you're forced to use the JVM by some executive degree or similar. Likewise, if you're in a .NET shop you'd want to consider F#. All that aside - I'm a huge Erlang fan.
- vikas5678 18y agoScala's concurrency model is based on Erlang actually, although the Scala actors are not OS independent like Erlang, but the message passing mechanism and the concept of light weight processes independent of each other exchanging messages( no shared states ) is common to both. Scala runs on the JVM so its much easier to integrate it with huge java projects, and its performance is comparable with Java, and its being promoted in a big way by many of the big names in the industry. I see scala being widely accepted, whatever little I've used of it, I really love!
- yariv 18y agoScala's actor library emulates a subset of Erlang's message passing capabilities, but it's far from what Erlang has to offer. Scala's actors are not distributed, they don't have their own heaps (Erlang processes do, to minimize garbage collection sweeps for soft real-time performance), they aren't preemptively scheduled by the VM (the only preemptive scheduling is done by heavy native threads), and they don't have "shared nothing" sematics because Scala lets you send pointers mutable objects between processes. Furthermore, Scala doesn't have hot code swapping or Mnesia, both of which are essential for building scalable fault tolerant systems in Erlang.
- simonw 18y agoI think you missed the point of the comparison. One of the reasons C++ took off was that it was deliberately compatible with C (the dominant language at the time), so you didn't have to discard your existing C code and could ramp up from your existing skills. Likewise, today the dominant language is Java, and Scala compiles down to Java bytecode and allows you to continue to use your existing Java libraries. To my knowledge Erlang doesn't have these capabilities.
- greyman 18y agoGood comment. We can't only look at the merits of the language itself, but also see wider context and circumstances in the software world. Thus my answer to the original question is: No, it isn't.
- albertcardona 18y agoFollowing the same argument, Clojure and Jython qualify just as well as Scala does.
- twism 18y agojavascript using rhino as well
- KirinDave 18y agoErlang can integrate with anything out there, because it deliberately discourages binary inclusion. Instead you make remote "ports" that act like servers or vendors of results. It's a very weird approach, but it's surprisingly effective.
- randomhack 18y agoWell can you give more info about these ports? Sounds like you want to do interprocess communication of some kind with the JVM? 1. How exactly would you setup the JVM? Will you need to wrap every Java class you want to use with some kind of communication mechanism? What about callbacks? 2. Can you subclass a Java class? 3. What is the overhead of calling Java methods from Erlang? 4. Has anyone demonstrated a bridge to a non-trivial Java library using a language not running on the JVM? I feel interprocess communication might be ok for some apps but not all apps.
- randomhack 18y agoErlang's fast? Compared to what? Scala is usually about as fast as Java. Not trolling. Genuinely curious.
- mikkom 18y agoErlang is fast if you are using multicore processors because it scales [almost] linerly by performance by core number.
- Tichy 18y agoAs it's creator said, the main purpose of Erlang is not to be fast, it is to be reliable. Sure, you can throw a lot of processors at it, but at the moment we are still not there (I just bought myself a QuadCore, not a QuazillionCore), and other languages might be able to benefit from more cores, too (once they arrive).
- mikkom 18y agoYou are totally right, scaling linearly is just a side effect of the shared nothing concurrency- and reliability-based programming model but it's quite a feature anyway!
- scott_s 18y agoDo you have data, or are you arguing that it should scale? An important lesson I've learned is that just because you've written a parallel program, doesn't mean you've written a good one.
- tokipin 18y agohere's a pdf about the language http://www.scala-lang.org/docu/files/ScalaByExample.pdf http://www.scala-lang.org/docu/files/ScalaByExample.pdf it's definitely not bad. whether or not a language has first-class functions is a major point for me, and Scala has strong support for functional programming and even has some specialized sugar for it the only thing i don't like about it is the type/object stuff, which always feels unnecessary
- scott_s 18y agoIf C++ had just abandoned it’s C legacy, it would have been a much nicer language. A much nicer language no one would have used. It is Stroustrup's opinion that if C++ had not been backwards-compatiable with C, it never would have become popular. I agree. I also have difficulty with calling C++ a "failure."
- tubby 18y agoYep... c++ is a great language. Doesn't force one paradigm onto the programmer. Fast, portable and very efficient too. I heard the new F-35 jet fighter is using c++ over ada.
- gcv 18y agoI took a look at Scala about six months ago. It's quite a nice, full-featured language, and is a real contender for anyone forced to deploy to the JVM. However, it has a lot, and I do mean a whole hell of a lot of growing up to do before I'd actually use it for anything. Its support for editors and tools was pretty horrible. The Eclipse plugin outright sucked (bundled compiler lagging behind the language release, syntax highlighting which came and went unpredictably, weird compilation errors which didn't matter --- and when I submitted a bug report ticket, the Scala team took four months to respond). I tried the Emacs mode, but it had such flaky indentation that I didn't know what it was doing half the time. If I absolutely had to use Scala, I'm sure I'd fix the Emacs mode, but it just wasn't worthwhile back then. In addition, the language changes rapidly in ways which break existing code (I ran into an incompatible change in the Actors library, but don't remember the details any more). Granted, that's actually a good thing, because it means that the developers do not want to be stuck with bad design decisions from the past, but I'd like to be able to write production code, too. Since it seems that Scala's authors use it as a testbed for their research in languages, I have my doubts that it'll stabilize quite enough. (Counterarguments welcome!)