From 1a41b3e0437346a3b1e5e7e3584c27a7bdc74d04 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 25 Oct 2016 14:25:27 -0700 Subject: [PATCH] make Scalafix blog post not so entirely Dotty-centric we hope and expect that Scalafix will be useful in a Scala 2 context, too. here are some proposed changes that reflect that hope. --- blog/_posts/2016-10-24-scalafix.md | 53 +++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/blog/_posts/2016-10-24-scalafix.md b/blog/_posts/2016-10-24-scalafix.md index f48b4869a..78c34e4f3 100644 --- a/blog/_posts/2016-10-24-scalafix.md +++ b/blog/_posts/2016-10-24-scalafix.md @@ -2,24 +2,21 @@ layout: blog post-type: blog by: Ólafur Páll Geirsson -title: "Introducing Scalafix: a migration tool for Scalac to Dotty" +title: "Introducing Scalafix: a code migration tool for Scala" --- I am excited to announce the first release of [scalafix](http://scalacenter.github.io/scalafix/), a new tool to -prepare Scala 2.x code for [Dotty](http://dotty.epfl.ch/), a next -generation Scala compiler. This effort follows the Scala Center Advisory +prepare Scala code for future Scala versions, including Scala 2.13 +and beyond as well as [Dotty](http://dotty.epfl.ch/), a next +generation Scala compiler. + +This effort follows the Scala Center Advisory Board proposal: ["Clarification of Scala to Dotty migration path"](https://scala.epfl.ch/minutes/2016/06/06/may-9-2016.html#proposal-scp-002-clarification-of-scala-to-dotty-migration-path). -There is a lot to be excited over in Dotty, -[faster compilation times](http://www.slideshare.net/Odersky/scala-days-nyc-2016), -[faster+smaller binaries](https://d-d.me/talks/scaladays2015/#/) and -[awesome error messages](http://www.scala-lang.org/blog/2016/10/14/dotty-errors.html) -to name a few things. However, some Scala 2.x applications can't -immediately enjoy these benefits due to several breaking changes in -Dotty. Scalafix is part of our strategy to smoothen the migration -process for those applications. +What can scalafix do? +------------------------- Scalafix takes care of easy, repetitive and tedious code transformations so you can focus on the changes that truly deserve your attention. In a @@ -30,7 +27,34 @@ many unsupported features as possible. There will be cases where scalafix is unable to perform automatic migration. In such situations, scalafix will point to the offending source line and provide instructions on how to refactor the code. The objective is that your -Scala 2.x codebase gets up and running faster with Dotty. +existing Scala code base gets up and running faster with new Scala versions. + +Scalafix and Scala 2 +------------------------ + +Scala 2.13 is still being planned, so we don't know yet exactly what +language changes it will include. But with Scalafix available to help +migrate existing code, changes could become possible that would +previously have been considered too disruptive because they would +require too much code to be updated by hand. Possible examples include: + +* Rewriting code to avoid the use of the now-disfavored + `language.postfixOps` syntax +* Deprecation of `any2StringAdd`, in favor of string interpolation +* Deprecation of procedure syntax, as in Dotty +* Changes to the Scala collections API + +Scalafix and Dotty +------------------------ + +There is a lot to be excited over in Dotty, +[faster compilation times](http://www.slideshare.net/Odersky/scala-days-nyc-2016), +[faster+smaller binaries](https://d-d.me/talks/scaladays2015/#/) and +[awesome error messages](http://www.scala-lang.org/blog/2016/10/14/dotty-errors.html) +to name a few things. However, some Scala 2.x applications can't +immediately enjoy these benefits due to several breaking changes in +Dotty. Scalafix is part of our strategy to smoothen the migration +process for those applications. What can scalafix do? ------------------------- @@ -64,10 +88,10 @@ def main(args: Seq[String]): Unit = { // note ': Unit =' } ~~~ -Dropping procedure syntax is part of a general effort in Dotty to +Deprecating or dropping procedure syntax is part of a general effort to simplify the Scala language. -The `VolatileLazyVal` rewrite adds a `@volatile` annotation to lazy vals, +The `VolatileLazyVal` rewrite adds Dotty's `@volatile` annotation to lazy vals, like this: ~~~scala @@ -212,4 +236,3 @@ experiments on millions of lines of Scala code? Come chat with us on developer tools of the future! [gitter]: https://gitter.im/scalacenter/scalafix -