Over a million developers have joined DZone.

The Similarities of Swift & Scala

· Java Zone

Discover how AppDynamics steps in to upgrade your performance game and prevent your enterprise from these top 10 Java performance problems, brought to you in partnership with AppDynamics.

You've probably heard about Swift by now, even if nobody actually knows it yet. And if you have, you might have noticed that it has a few things in common with Scala. You wouldn't be the only one:

But if you're not yet persuaded, or if you'd just like to see these similarities fully explored, Jacob Leverich has you covered with "Swift is a lot like Scala."

Leverich's rundown of the similarities is thorough and well-organized, presenting a wide variety of common programming techniques compared in Swift and Scala with side-by-side code snippets. Something like this:

(Credit: Jacob Leverich, "Swift is a lot like Scala")

It's all split up into a handful of broad concepts:

  • Basics
  • Collections
  • Functions
  • Classes

So you can see how where they match up and where they differ. It's an interesting look at the two languages and the ways they overlap, and Leverich is careful to clarify that many of these similarities are fairly superficial. When you dig deep enough, he says, they start to disapper:

...Swift's runtime environment is quite distinct from Scala's, and is perhaps the most interesting aspect of the new language. Scala compiles to the JVM, uses garbage collection, and its object model transparently integrates with Java. Swift compiles to native code, uses automatic reference counting, and its object model transparently integrates with Objective-C. Thus, the similarity between the two languages does not extend much below the surface.

Check out Leverich's full post, and leave us a comment if you've noticed any other similarities.


The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}