7 ms·
I'm curious to know the target user. There's no JVM interop, so one of the main reasons to use Scala -- an evolution of Java the language -- is out. Plus with K
by azinman2 7y ago
I'm curious to know the target user. There's no JVM interop, so one of the main reasons to use Scala -- an evolution of Java the language -- is out. Plus with Kotlin even that reason is being outdated, especially as you lose all the type conversions between Java arrays and Scala arrays, etc. Their C struct example has a lot of awkward syntax, so it seems that it's a bit 'bolted on' versus inherently designed for this use case. We have both Swift and Rust as great higher-level languages that compile to native applications with C interop, with more robust ecosystems and faster progress (Scala moves at glacial paces in comparison)... both appealing for different use cases.
I used to be a Scala enthusiast before these alternatives existed. What place does Scala now have in the world?
- jpgvm 7y agoIt's place is when you want a functional JVM language and would prefer not to use Clojure. As you accurately pointed out for a "better" Java you probably want Kotlin - which has better compatibility with Java, is supported by big players (JetBrains, Google) and because of being the blessed language for Android is growing in popularity very fast.
- zapzupnz 7y ago> It's place is when you want a functional JVM language and would prefer not to use Clojure. I think GP meant the place of Scala Native, where being a JVM language is irrelevant.
- dwohnitmok 7y agoMy take as a continuing regular Scala programmer: Scala's position in the standard JVM world hasn't changed too much. Kotlin has taken up some of the "better Java" part of Scala, but otherwise Scala still maintains its niche of statically typed FP (mixed in with OO) on the JVM. Scala on Android has withered (Kotlin really took off here). Scala Native unfortunately also has kind of withered too, but GraalVM picks up the slack there in allowing for native compilation. Scala.js (compiling Scala to Javascript) has become surprisingly mature.
- zmmmmm 7y ago> you lose all the type conversions between Java arrays and Scala arrays This is what killed scala to me. It talks up a big story about Java interop, but the reality is that the separate collections really drive a wedge between the scala ecosystem and the rest of the JVM world so it does not have the kind of seamless iterop that Kotlin and (especially) Groovy do.
- dwohnitmok 7y agoI have my share of grievances against Scala, but the difference in collection libraries only feels painful if your app can't tolerate the performance hit of re-copying a collection (which to be fair does sometimes occur on hot codepaths). Otherwise it's a simple .toScala or .toJava call away. Also arrays are one place where Scala and Java do happen to share the same collection.
- pjmlp 7y agoA good example of why platform languages always reign on their turf.
- cheriot 7y agoScala is great for statically typed functional programming. It can be as pure as Haskell, but with the escape hatch of not requiring that purity at the language level. With Scala 3 coming out next year it will become more approachable to developers that find Haskell and OCaml off putting (and has already solved the "python 3 problem"!). As for scala-native, it gets past the major draw backs of the JVM: startup speed, memory size, and Oracle. From applets in 2002 to kubernetes sidecars and aws lambda today, the JVM refuses to optimize for these things.
- pjmlp 7y agoWhat a joke. Currently Scala.Native still performs poorly than Scala JVM. Since 2000 anyone that cared about AOT in Java had quite a few commercial Java vendors that offered AOT on their JDKs, Oracle and IBM were two of them. Project Panama, Valhalla, Metropolis and Graal are proof that Java community does care to optimize for these things.
- densh 7y ago> Currently Scala.Native still performs poorly than Scala JVM. This is factually incorrect [1]. 0.4.0 series is shipping with brand new optimizer (as of M1) and soon a parallel garbage collector (M3). Both contribute to major performance overhaul compared to the current stable 0.3 branch (see benchmarks on the link below). [1] https://github.com/scala-native/scala-native/releases/tag/v0.4.0-M2 https://github.com/scala-native/scala-native/releases/tag/v0...
- pjmlp 7y agoBenchmarks against all major Java implementations?
- cheriot 7y agoSo developers can choose to have the batteries included or to pay a vendor. I hear signing contracts with IBM and Oracle is a great experience. Is that the joke? > proof that Java community does care Oh, the community wants them. It's been Sun then Oracle and now the OpenJDK project that has never prioritized these things and that's the runtime 99% of JVM shops run.
- bad_user 7y agoFor me Scala was never about using a Java++. If you want Java++, the best Java++ is still Java with a bunch of libraries. You don't need a new language for that. Kotlin's succes is effectively because Google was late to port Java 8 to Android. A fine language btw, but it will either become more like Scala, or it will wither away eventually. My bet is in it becoming more like Scala, as evidenced by arrow-kt.io Scala has a blend of features that makes it the most expressive mainstream functional programming language, most importantly ... implicits, by which you can model typeclasses and higher kinded types. And in Scala we've got an active community of FP libraries. Actual FP, emphasizing referential transparency, with abstractions built for suspending effects. It's a little known fact but the kind of FP programming we do in Scala tends to be more pure than what happens in OCaml, F#, Erlang, Clojure and others. Also, we have a Scala to Javascript compiler, all the tooling works with it and we've got an ecosystem of libraries cross-compiled to Javascript. As for Scala Native, it has its place. The problem has been lack of manpower to bring it to the maturity that Scala.js is at.
- idnefju 7y ago> It's a little known fact but the kind of FP programming we do in Scala tends to be more pure than what happens in OCaml, F#, Erlang, Clojure and others. What do you mean by pure exactly? IO Monad? Simply no side effects?
- bad_user 7y agoYes. Many libraries in the FP Scala community are concerned with modeling effects in a pure way.
- idnefju 7y agoOh interesting view. It's funny since Scala's author himself doesn't consider the IO monad to be "pure". > “The IO monad does not make a function pure. It just makes it obvious that it’s impure.” https://groups.google.com/forum/#!topic/scala-debate/xYlUlQAnkmE%5B251-275%5D https://groups.google.com/forum/#!topic/scala-debate/xYlUlQA...
- _nhynes 7y ago> What place does Scala now have in the world? serious answer: chisel3 other serious answer (at least to me): the ability to write incredibly terse code. For instance Rust, as great as it is, doesn’t have partial application. iter.map(|x, y| f(x.as_ref(), y))? is so much less satisfying than iter.map(f(_, _)) I’m pretty sure you could recover that behavior using a compiler plugin, though. Also, don’t get me started on implicit conversions... I’m an avid golfer. Other than not having (usable) macros, the language itself has very nice amenities. SBT was like an early Cargo, even.
- _ZeD_ 7y agoI lost so many weeks trying to decode the fk of the code written in scala with so much "magic" in it. And I'm working with a colleague to "unmagic" it in our source base.
- realusername 7y agoYeah that's exactly my feeling on Scala after debugging some "magic" code, it feels like a functional perl where you write whatever you want and good luck if someone else will need to read it later.
- serpix 7y agoSpoken from true experience, I've also been staring down at some Scala magic and wondering how in the earth did we end up in this hole.
- anon9001 7y agoI personally believe that people who bring functional programming into commercial settings are wrong to do so. There's a real trend lately to go "big" and "functional", but know that it causes actual business problems. If I have to inherit code, I'd take (JavaScript|Rails|PHP|Python)+(MySQL|PostgreSQL) over (Scala|Haskell|F#|Lisp)+(MongoDB|Cassandra|Kafka) any day. I understand that all of these tools have their uses, but the most important thing is ease of finding decent developers. Lots of people can do JavaScript well, but few can do Scala, so you're going to have a smaller pool of talent. More popular languages are also going to have more developed patterns, more native libraries, and better tooling options. If you need Scala, please just write Java. You'll always be able to hire a Java dev. Everyone hates writing Java, but everyone can write Java. And related, if you're using any kind of NoSQL for your business data, you're wrong. I understand NoSQL for caching and document storage, but not everything is a document. Most things are actually best in SQL tables. Especially if you're a startup.
- misja111 7y agoScala is suited best for those who like to do FP in an enterprise environment. With Cats or ScalaZ you can get Haskell-like syntax, and the advantage over Haskell is that Scala runs in the JVM and it provides interop with Java libraries.
- azinman2 7y agoBut this is Scala native we’re talking here. No JVM.
- rwhaling 7y agoI've been using Scala Native for two years now, and I find that it's C interop is state-of-the-art. The way I would pitch it is: Scala Native gives you the capabilities and performance of C, embedded in a Scala DSL. In particular, pointer arithmetic and memory allocation feel really smooth, and struct syntax is getting reworked for the upcoming SN 0.4 release. The affinity with C, and with systems programming in general, isn't something you necessarily get with Swift or OCaml to the same extent. And even Rust, although it is outstanding for some systems tasks, isn't 100% mature on concurrency and async use cases yet. In contrast, Scala Native works really nicely for low-level concurrent programming - I'm writing a book about SN for Pragmatic at the moment [1], and the entire second half is about building up a fully concurrent backend service framework, from scratch, using C libraries like libuv and libcurl. We're also preparing to release an official libuv binding for Scala Native 0.4 [2] 1: https://pragprog.com/book/rwscala/modern-systems-programming-with-scala-native https://pragprog.com/book/rwscala/modern-systems-programming... 2: https://github.com/scala-native/scala-native-loop https://github.com/scala-native/scala-native-loop