Live data from Hacker News

Google, it's time – We want Scala for Android

blog.madhukaraphatak.com

101–110 of 148 posts

Re: Google, it's time – We want Scala for Android

#101
Over the last few months I've been writing Scala full time, and have even written some (demo grade) Android apps in it. My opinion is: Android should not adopt Scala as one of its primary languages.

I think a platform's primary language should be accessible. It is an unfortunate fact that the stuff that most people only know about programming using some object oriented imperative language. People find it harder to hobby with unfamiliar styles, and it is hard to find leverage within your organization to go into unknown territory. If it isn't a popular widely known language (Java) it should at least resemble popular widely known languages (Swift). Give people a piece of Java or Swift code, and they can read it. Give people a piece of Scala code, and they usually cannot.

Scala can be an accessible language; its imperative syntax is really nice. But Scala is not an accessible language in that idiomatic real-world Scala and most of its libraries are written in a wholly unfamiliar style. Powerful, yes. People should learn it, yes. But if Scala comes to Android it will only serve to make the platform seem less accessible. And that's a much bigger downside than whatever expressivity Android Java currently lacks.

Scala can't even properly be a primary language in parallel to Java at the moment. Swift is just a better syntax for expressing idiomatic Objective C programs. Good Swift programs should look mostly like good Objective C programs with a different syntax - Swift has been made for this purpose [1]. Scala is not a better syntax for expressing idiomatic Java programs. Despite backwards compatibility, good Scala programs look very different to good Java programs. This means that Google cannot present them as equivalents. The Android platform APIs heavily promotes mutability which makes writing idiomatic Scala code for Android a pain in the ass. Should Google ask people to write non-idiomatic code for their new primary language, or should Google provide new APIs for their new primary language?

I dislike Java very much. But I think it's a great language for Android, because everyone can do it and that makes the platform accessible. There's only one other language I can even remotely imagine in its place, and that's Dart. And that's not happening either.

In the meantime, making Scala run on Android is perfectly doable. That is good enough for me.

[1]: I'm aware that this comparison doesn't do Swift as much justice as it should.

Re: Google, it's time – We want Scala for Android

#102

Earlier quoted context omitted.

Scala is an immensely popular jvm language (as far as jvm langaugesg go). That's why it would be a good candidate.

Scala and Groovy both have about 2% mind share on the JVM. I wouldn't call that "immense".

Are you counting java in that percentage? What is the percentage of scala out of non-java jvm languages?

Re: Google, it's time – We want Scala for Android

#103

Earlier quoted context omitted.

There's no substantiative argument in this comment. > Scala, as a programming language, tries to incorporate too many concepts Too many concepts? Says who? How many concepts is too many? You don't have to use them all, and you can pick them up fairly easily as you go along; that's exactly how I learned the language. > while still trying to be typesafe. Not sure why that's contentious. > This makes the language comple…

> Says who? Says at least me and the OP, and probably others... I haven't put a ton of time into learning Scala and only occasionally interact with it, but in that capacity I'd definitely say I find it a bit intimidating and someone hard to read. Certainly there are many ways to write Scala, and a Java-like style is doable, but idiomatic Scala, as far as I've seen, encourages terseness and the use of opaque punctuati…

Scala doesn't really have an idiomatic style. There's no "The Scala Way" to do things. What you've encountered are functional programmers who really love terse programming, but terse programming is no more idiomatic in Scala than Java-style programming. You can even keep the semi-colons and explicit type declarations if you want.

Re: Google, it's time – We want Scala for Android

#104
post #21

Earlier quoted context omitted.

It still doesnt change the fact that Scala, as a programming language, tries to incorporate too many concepts while still trying to be typesafe. This makes the language complex, and not an ideal candidate.

There's no substantiative argument in this comment. > Scala, as a programming language, tries to incorporate too many concepts Too many concepts? Says who? How many concepts is too many? You don't have to use them all, and you can pick them up fairly easily as you go along; that's exactly how I learned the language. > while still trying to be typesafe. Not sure why that's contentious. > This makes the language comple…

> So what? You don't need to know all the concepts to be proficient

Yes, you do. We heard this kind of argument with C++ twenty years ago. You can choose to ignore huge portions of the language for your personal use, but once you start working on a team, you will have to know the entire language.

Re: Google, it's time – We want Scala for Android

#105
post #94

Earlier quoted context omitted.

I think this is actually the crux of the issue. The language gives you enough rope to hang yourself with, and when people do hang themselves with it, those who look in from the outside throw the baby out with the bathwater.

I think that's definitely it. That old Dispatch periodic table has done a lot of damage to Scala's reputation IMO (even though it's no longer used by Dispatch). Looking at the major Scala libraries and frameworks today, I don't see a ton of symbolic operators in use. Akka just has ! and ? (both of which have very obvious uses once you understand actors), Play only uses them for iteratees (which most devs will never h…

Scalaz is not even ASCII. That shit's seriously scary.

Re: Google, it's time – We want Scala for Android

#106
post #63

Earlier quoted context omitted.

> It's one of the few languages where you can mix static and dynamic typing In theory, but in practise virtually everyone uses the dynamic typing only. Groovy's really only used with Grails and for testing Java classes. > Android, running Groovy with CompileStatic enabled by default would make a lot of sense Unlike other statically-typed languages, Groovy's CompileStatic code was written by only one person and having…

> but in practise virtually everyone uses the dynamic typing only. Why ? is it a social thing? or a technical thing?

Any optional and inconvenient feature in a programming language will never be used. It's why static typechecking in Python and Pypy and whatever will never take off.

Re: Google, it's time – We want Scala for Android

#107
post #38
post #2

I agree that Google should add more languages to android. And while Scala is a great language, it's very complex - so it won't benefit many of the less skilled users. A better language would be something with the simplicity and power of python, but with good performance.Groovy could be one such language.

Groovy's founder has said that he wouldn't have bothered creating it if he'd known about Scala at the time. In Scala you can write almost the same code as Groovy, word for word - but you don't have to give up compile-time type safety for it. (Of course you can do more complex things in Scala, taking advantage of the powerful type system. But you don't have to if you don't want to)

> Groovy's founder has said that he wouldn't have bothered creating it if he'd known about Scala at the time.

And shortly after that, he became a full time contributor to the Kotlin language.

Re: Google, it's time – We want Scala for Android

#108
post #16

Earlier quoted context omitted.

It's coming in 1.4 https://docs.google.com/document/d/1N3XyVkAP8nmWjASz8L_Ojjnj...

In their native SDK. Have fun writing JNI bindings. They are doing it for games too, great.

In the name of all that is holy use JNA if you can. It makes JNI not-insane.

Re: Google, it's time – We want Scala for Android

#109
post #2

I agree that Google should add more languages to android. And while Scala is a great language, it's very complex - so it won't benefit many of the less skilled users. A better language would be something with the simplicity and power of python, but with good performance.Groovy could be one such language.

Scala is not complex in terms of the language design. Most of features [or complexity] come from the libraries.

Not true, the mix of functional and OO features make the language complex even without the libraries. Throw in implicits, higher kinds, pattern matching, a fairly good generic type system, support for all kinds of polymorphisms (subtyping, ad hoc, duck typing), etc... and you can see complexity emerge pretty quickly.

Re: Google, it's time – We want Scala for Android

#110
post #91

Earlier quoted context omitted.

Scala is not complex in terms of the language design. Most of features [or complexity] come from the libraries.

Implicits? Compared to Java, Scala is not a simple language. I'd say Scala's complexity is on the order of Haskell + Java syntax with additional glue on top of that. Not to say this is bad, it just means you need greater discipline when writing software in Scala. A bit like C++ (yes, I went there! :-)).

I'd say this makes Scala slightly more complex than C++ and Ada. Java and Haskell are not in the same league when it comes to complexity (Java because it's simple, Haskell, because it's wickedly well designed so its complexity is completely tractable).
Post reply on HN