Scala Native 0.3.7
github.com
github.com
However, its use cases seem to be encroached on all fronts.
If you want native, performance and don't need the JVM ecosystem, Rust and go both take very different but good approaches to that problem. I would have a hard time recommending Scala Native over Rust.
If you want browsers, Javascript is rapidly evolving and becoming a better lanuage. Typescript adds an excellent type system given the constraints its working with. Webassembly opens the door to use your own favorite. I would have a hard time recommending Scala.js over Typescript.
If you want JVM, Java is adopting traditional Scala killer features at a glacial pace, lambda's in 8, pattern matching in 11+ [1], Data/Case classes in ? [2], but adopting them nonetheless. Kotlin has succesfully performed a Blitzkrieg maneuver on Scala's "better Java" territory and has full support from Google in Android. It's also much more approachable for Java devs. I have a hard time convincing JVM devs that Scala is a good choise over Kotlin. At the place I work in all new projects are Kotlin, and Scala is used for the projects that were started in it.
Python and R are mainstays in the data science world, with Spark serving as a sort of Scala bastion.
I like scala, and follow its developments and 3.0 (Dotty) version somewhat, but I am slowly seeing it dwindling into irrelevance.
[1] http://openjdk.java.net/jeps/305 [2] http://cr.openjdk.java.net/~briangoetz/amber/datum.html
There are plenty of things wrong with Scala - in many ways I'd like to see a clean replacement - but now that I think in HKT I could never go back to a language that doesn't have them.
[1] http://philipnilsson.github.io/Badness10k/escaping-hell-with...
[2] https://github.com/lancewalton/treelog
[3] https://github.com/slamdata/matryoshka
[4] https://doc.akka.io/docs/akka-http/10.0.4/scala/http/introdu...
Scala won't be the next Java. However, _some_ Scala-like language will be the next Scala, probably EPFL Dotty [0] or Twitter Reasonable Scala [1] Short term, also Lightbend Scala is evolving (collections redesign [2], macros EOL [3])
Just upgrading existing Scala projects will keep most Scala devs employed.
[0] https://github.com/lampepfl/dotty
[1] https://github.com/twitter/rsc
Scala Native would win over Rust and Go, which are too low-level. Scala Native would win over python/ruby because of the ease of deployment (e.g. compile to target CPU) and static typing.
However, Crystal probably wins over Scala Native...
Other native languages should be able to do the same in the near future (I hope).
https://ocaml.github.io/ocamlunix/
And it has an eco-system that goes all the way back to 1996.
Can we compile code into a single binary and run it on a user's machine without any extra installation? Does it work with Windows?
OCaml can also compile to bytecode, usually used on the REPL or just to speed up the development cycle.
Your single binary might depend on glibc by default. If you want a pure static library then you need to customize the toolchain to use another C library like musl.
And yes, it does work on Windows.
For example:
1. Rust is on a lower level of abstraction than Go is. Because, in Rust, when we use strings we have to think whether we should use `String` or `&str`. In many types of applications, we just want a string. We don't care which type of a string we need. It's too much detail.
2. Golang is on a lower level of abstraction than, say, Ruby on the aspect of error handling. Maybe, for a command line tool, I don't want to explicitly handle exception on every statement. I just want it to exit if an error occur. It's too much detail.
3. Python can be thought of as being on a lower level of abstraction than Ruby. For example, in Python, there are 3 ways of getting the first element of an array or null (https://stackoverflow.com/questions/363944/python-idiom-to-r..., well, which one is better?) In Ruby, the function is already encapsulated in main library (e.g. `.first`), and people don't have to care of this kind of detail.
Why? Scala is so much nicer.
> I would have a hard time recommending Scala.js over Typescript.
For this too, Scala is so much nicer. The base libraries are far better than in both Rust and TS.
> I have a hard time convincing JVM devs that Scala is a good choise over Kotlin. At the place I work in all new projects are Kotlin, and Scala is used for the projects that were started in it.
That sounds strange. I know Scala's got some warts and all, bit I still can't imagine Scala devs wanting to downgrade to Kotlin.
The type system is very good. Denys Shabalin is doing amazing work but Scala Native is still an early mostly 1-man project and not production ready, rust is a production-ready language with a large number of backers. The rust ecosystem is much larger than the Scala native ecosystem.
> Typescript
Types solve my biggest gripe with Javascript. It's singleton and union type support is leagues ahead of Scala and Dotty and a decent patch for some of its omissions. It's a much closer fit to browsers. The ecosystem is gigantic. Frontend devs know Javascript, you can convince them to learn Typescript but not Scala and the ramp-up time on Typescript is super low.
> Switching to Kotlin
The Scala devs aren't happy with it, but ultimately it's about the project not the language. It's mostly new hires and previous Java devs that have a negative impression of Scala and prefer Kotlin.
What? I don't understand it's better than dotty which has a proven core? Typescript's type system wasn't (isn't? I don't know) even sound.
> Java devs that have a negative impression of Scala and prefer Kotlin
To each their own but if you learn Scala you can never go back to Java/Kotlin, there is not even a contest.
Edit: newlines added
type Shape = Point | Circle
interface Point {
type: "Point"
x: number
}
interface Circle {
type: "Circle"
center: number
}
let x: Shape = foo()
if(x.type == "Circle")
log(x.x) // Error
It's enterily generic and flows through the whole type system. It makes nullability trivial and `Option` superfluous, since `Option<T>` is an alias for `T | null`. If you check it for null once the type will immediately become `T` from then on.Try something like this with Dotty's enums, it's super easy to hit the limits there.
That's not even what I was talking about...
I admire what scala.js is and I've dabbled with it for my startup for my own indulgence but it's window for viability is tiny.
Well yes, in the same way everyone here is... But no, if you look at the features of the languages there's a clear difference.
Higher kinded types.
There is some truth in the statement, in that a Scala team will often gradually adapt more advanced features of the language. I wouldn't call them different languages, but rather say Scala is a "Java N+5" in that sense. Java 8 is objectively much more advanced than Java 4, but it's very much the same language and a Java 4 dev will get used to and see value in Java 8's new features. Same with Scala .
The main schism is what some people jokingly call the "compiling Haskell with scalac" crowd. They are hardcore functional programmers who value FP ideals like category theory over all else. There even is a forked Scala compiler [1] (luckily the fork and mainline reconciled, and now every change in the fork is a PR for mainline). The crowd is mostly exemplified by libraries like ScalaZ [2] and to a lesser extent Cats [3] and shapeless [4]. Some even advocate replacing the whole Scala standard library with their own. Can you at that point still say you're using Scala? You can probably read that I do not personally like that style, and consider it a detriment to the community†, so consider my statements in light of that opinion.
The main reason why I don't like the style is that Scala is not powerful enough when compared to Haskell or Julia, requiring lots of magic and boilerplate to make it work. Maybe this will ultimately be resolved, as there have been gradual improvements over versions, and this will be the final niche Scala will occupy long-term, as I have not seen any contenders yet.
† I have tremendous respect for the maintainers of the library and their skills, but I don't think the schism is healthy.
[1] https://typelevel.org/scala/
[2] https://github.com/scalaz/scalaz
At Verizon I worked in projects that were pure FP/heavy Scalaz, as well as working in scala projects that were basically java++.
Both of them were projects I had architectural input on, but depending on the teams comfort level, we decided upon what style of Scala would be used.
The language is deeper than some others, and while a java programmer might be able to pick up python in a few days and vice versa, there's definitely going to be more of a learning curve to pick up 'FP style Scala'. However, we had people who had no prior Scala experience come in and dive in successfully to even our most hardcore FP projects. As long as you are OK with a bit of ramp up, the disparity between various styles of Scala are a bit exaggerated in my experience.
To pick on my favourite scripting language, Python, you can go from "I just learned to print hello world" style up to "look at me, master of meta-programming with multiple inheritance and dynamic code generation".
And this not counting all the changes that have happened throught all Python releases, with semantic impact how the code gets written.
Yet many assume it is a "simple" language.
http://tomstechnicalblog.blogspot.hk/2016/11/using-kotlin-la...
Not according to Tiobe.
https://doc.akka.io/docs/akka/2.0/java/index.html
Not sure about the relative ergonomics of Akka-in-Scala versus Akka-in-Kotlin (via the Java API).
I couldn't figure out the IntelliJ tooling, though, that's still lagging. I have to turn off the scala-native plugin to get the IDE to recognize the code, and then turn it back on whenever I want to generate the executable.