Hacker News new | ask | show | jobs
by melling 2366 days ago
What is the story with Scala on Android? Years ago I thought it was a matter of using too much memory. There’s not much talk about it but it does seem to be possible:

https://scala-android.org/

Will Scala 3 help?

3 comments

As the person who was involved in Scala on Android (and particular in creating the website), I'll chime in with this:

What sunk Scala on Android was largely the completely lack of interest from the core team.

Everything that Scala on Android achieved was pretty much _despite_ the actions of Scala's upper echelon.

- It's hard to get a good message out, when core members spread FUD by bringing up problems that were solved year ago (like the big std lib issue).

- The core team's perception of Scala was always inward – new platforms existed such that Scala developers could run their code in more places, not because it could attract new developers from these existing ecosystems to Scala.

(Scala.js partially overcame this by herculean efforts of individual members of the Scala.js community that got the word out to the JavaScript world about Scala.js.)

- Core Scala pulled the plug from Android support in the backend. So Scala on Android was pretty much left to die on an outdated Scala version.

- Something like TASTY (an interchange format that can be recompiled on the fly to target new backends), which could have dealt with the problem above – was promised for years, but still hasn't shipped.

- The core team was against even acknowledging the existence of Scala on Android on the website – good luck in convincing that Scala on Android works, if the official website/documentation doesn't mention it with a single word.

- Core Scala treated the main contributor with so much public disrespect, that I'm still surprised he didn't outright quit back then. It takes balls to publicly blame the main contributor of Scala-on-Android for not working on the project full-time, but also conveniently managing not to tell him this crucial "requirement" for half a decade. And with "full-time" I mean "unpaid full-time".

It's a sad story, because Scala-on-Android shipped with some amazing features like hot-code-replacement years before Google managed to ship it. The typed resources stuff was also pretty impressive.

So, no, Scala 3 won't help. Most people who cared left years ago.
I don't know the whole story. Perhaps somebody who knows can chime in. But my impression is that Android being stuck basically on pre-Java 8 at the time while Scala relying heavily on Java 8 features was one complication. Scala generating a bunch of class files for lambdas and so on with no SAM types + invokedynamic to reduce all that plus strange DEX limitations might have caused issues. Plus memory limitations like you said.

I'm not sure there are any real blockers for Scala on Android anymore. I imagine it's mostly a resource problem now. With Kotlin's momentum in that space though, I'm not sure too many people are calling for it anymore. Who knows though, maybe after Scala 3 is finally out the door priorities could shift.

> not sure there are any real blockers for Scala on Android anymore. I imagine it's mostly a resource problem now

not really, it's still the problem Android being Java < 8, and Scala on Java 8 features.

https://github.com/scala-android/sbt-android/issues/334#issu...

From a few years ago, with Scala 2, but the fundamentals may not have changed much.

Scala had, and has, a large bespoke standard library, which is big enough that if you tried to ship it with even a trivial app, it exceeded limits not just on memory, but on numbers of classes, methods, and so forth. (And even if those limits have been raised on newer phones, older ones are still a nontrivial market segment.)

So the way people got around that was by using "tree shakers", which would grovel through the app and its libraries, and chuck out portions of the library which weren't actually used. This works, but significantly complicates the development toolchain.

Between that and the official support for Kotlin as the "better Java" dialect of choice, you have to really like Scala to make it worth the effort...