Google's Steve Yegge gave a presentation at the recent Google I/O conference, focusing on his work with Rhino, the JVM-based JavaScript implementation. Yegge published a transcription of his presentation in Rhinos and Tigers.
While most of Yegge's talk centers around the importance of server-side scripting, and why Rhino and, by extension, JavaScript, are good choices for scriptable server applications, he also discusses the choice between static and dynamic typing in a language. He especially notes that Scala's more rigorous type system can pose a dilemma to Java developers who prefer static typing on the JVM:
I've got the [Scala] language spec here in my backpack. Oh, my god... I mean, like, because it's getting a little bit of momentum, right? So I figure I've got to speak from a position of sort of knowledge, not ignorance, when I'm dissing it...
And so before, I was like: "Oh yeah, Scala! Strongly typed. Could be very cool, very expressive!"
The... the the the... the language spec... oh, my god. I've gotta blog about this. It's, like, ninety percent [about the type system]. It's the biggest type system you've ever seen in your life, by 5x. Not by an order of magnitude, but man! There are type types, and type type types; there's complexity...
But the funny thing about Scala, the really interesting thing — you guys are the first to hear my amazing insight on this, OK? — is: it's put the Java people in a dilemma. There's a reeeeeeeal problem...
The problem is, the Java people say, "Well, dynamic languages, you know, suck, because they don't have static types." Which is kind of circular, right? But what they mean, is they say: No good tools, no good performance. But even if you say, look, the tools and performance can get as good, they say, "Well, static types can help you write safer code!"
It's... you guys know about those talismans? The ones, where, "What's it for?" "To keep tigers away"? (some chuckling) Yeah? And you know, people are like, "How do you know it keeps tigers away?" And your reply is: (sneering) "Do you see any tigers around here!?" (minor laughter)
Scala, now, is the tiger that's going to kill Java. Because their [type-talisman] argument now has become a paradox, similar to the Paul Graham Blub Paradox thing, right? Because they're like, "Well, we need static typing in order to engineer good systems. It's simply not possible otherwise."
The Scala people come in and they go: "Your type system suuuuuucks. It's not sound. It's not safe. It's not complete. You're casting your way around it. It doesn't actually prevent this large class of bugs. How many times have you written catch (NullPointerException x) ... in Java? Our type system doesn't allow [things like] that... Our type system does what you said your type system was doing...
So, therefore, you should be using it!
And the Java people look at it and go: "Wehellll... (cough cough)... I mean, yeah, I mean... (*ahem*)" (running finger under collar, as if sweating profusely) They say, "Welllll... you know... it's awfully... cummmmmbersome... I..."
"We can actually get around the problems in practice that you guys say your type system is solving through Good Engineering Practices."
Yegge follows these notes about the Scala type system with some examples from his own work where dynamic languages were able to scale to large numbers of users, as well as large numbers of developers:
Let's do proof by – say, argument by example! You know, an existence proof. IMDB is written in Perl, right? Yahoo! – many of their properties are written in PHP. A lot of Microsoft stuff's written in VB, right? ASP .NET? Amazon.com's portal site is Perl/Mason...
A lot of companies out there are building big, scalable systems – and I mean scalable in the sense of throughput and transactions, stuff like that, but also scalable in terms of human engineering — in these dynamic languages with no static types. [Using nothing more than good engineering principles.]
What do you think about Yegge's comments regarding Scala's type system and dynamic languages?