From 362a363e2f4431686d680c43a44c30addabe201f Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:15:28 +0200 Subject: [PATCH 01/14] Operator rules documented --- ...2019-05-24-15th-dotty-milestone-release.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md new file mode 100644 index 000000000000..4f7bba68beb6 --- /dev/null +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -0,0 +1,161 @@ +--- +layout: blog-page +title: Announcing Dotty 0.15.0-RC1 with TODO +author: Anatolii Kmetiuk +authorImg: /images/anatolii.png +date: 2019-05-24 +--- + +Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of improvements + +This release serves as a technology preview that demonstrates new +language features and the compiler supporting them. + +Dotty is the project name for technologies that are being considered for +inclusion in Scala 3. Scala has pioneered the fusion of object-oriented and +functional programming in a typed setting. Scala 3 will be a big step towards +realising the full potential of these ideas. Its main objectives are to + +- become more opinionated by promoting programming idioms we found to work well, +- simplify where possible, +- eliminate inconsistencies and surprising behaviours, +- build on strong foundations to ensure the design hangs together well, +- consolidate language constructs to improve the language’s consistency, safety, ergonomics, and + performance. + +You can learn more about Dotty on our [website](https://dotty.epfl.ch). + + + +This is our 14th scheduled release according to our +[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). + +# What’s new in the 0.15.0-RC1 technology preview? +## Operator Rules +This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. + +Methods with symbolic names like `+` are allowed to be used in an infix position by default: + +```scala +scala> case class Foo(x: Int) { def +(other: Foo) = x + other.x } +// defined case class Foo + +scala> Foo(1) + Foo(2) +val res0: Int = 3 +``` + +Methods with alphanumeric names are not allowed to be used in an infix position by default. Breaking this constraint will raise a deprecation warning: + +```scala +scala> case class Foo(x: Int) { def plus(other: Foo) = x + other.x } +// defined case class Foo + +scala> Foo(1) plus Foo(2) +1 |Foo(1) plus Foo(2) + | ^^^^ + |Alphanumeric method plus is not declared @infix; it should not be used as infix operator. + |The operation can be rewritten automatically to `plus` under -deprecation -rewrite. + |Or rewrite to method syntax .plus(...) manually. +val res1: Int = 3 + +scala> Foo(1).plus(Foo(2)) +val res2: Int = 3 +``` + +As the warning says, if you want the users of your library to be able to use it in an infix position, you can do so as follows: + +```scala +scala> import scala.annotation.infix + +scala> case class Foo(x: Int) { @infix def plus(other: Foo) = x + other.x } +// defined case class Foo + +scala> Foo(1) plus Foo(2) +val res3: Int = 3 +``` + +The above change will allow for more consistency across the code base, as the author of a method is able to make a decision on how the method is supposed to be called. + +To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1. + +### Compatibility: the `@alpha` annotation + + +## Other changes + +Some of the other changes include: + +- `infer` method renamed to `the`, the semantics of which is now the same as that of the `the` method of Shapeless. Namely, the implicits are resolved more precisely – see this [gist](https://gist.github.com/milessabin/8833a1dbf7e8245b30f8) for an example in Shapeless, and the Dotty [documentation](http://dotty.epfl.ch/docs/reference/contextual/inferable-params.html#querying-implied-instances) for more details. +- The syntax of quoting and splicing was changed. Now the quoting is expressed via `'{ ... }` and `'[...]` and splicing – via `${...}` and `$id`. Please see the [documentation](http://dotty.epfl.ch/docs/reference/other-new-features/principled-meta-programming.html) for more details on these features. + +# Let us know what you think! + +If you have questions or any sort of feedback, feel free to send us a message on our +[Gitter channel](https://gitter.im/lampepfl/dotty). If you encounter a bug, please +[open an issue on GitHub](https://github.com/lampepfl/dotty/issues/new). + +## Contributing + +Thank you to all the contributors who made this release possible! + +According to `git shortlog -sn --no-merges 0.13.0-RC1..0.14.0-RC1` these are: + +``` + 214 Martin Odersky + 151 Nicolas Stucki + 71 Liu Fengyun + 53 Guillaume Martres + 26 Olivier Blanvillain + 10 Aleksander Boruch-Gruszecki + 9 Aggelos Biboudis + 6 Miles Sabin + 4 Allan Renucci + 4 Dale Wijnand + 3 Anatolii Kmetiuk + 2 Fengyun Liu + 2 Alex Zolotko + 1 gnp + 1 tim-zh + 1 Dmitry Petrashko + 1 Dotty CI + 1 Jasper Moeys + 1 Jentsch + 1 Jim Van Horn + 1 Lionel Parreaux + 1 Master-Killer + 1 Olivier ROLAND + 1 Robert Stoll + 1 Seth Tisue + 1 Tomasz Godzik + 1 Victor +``` + +If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! +Head to our [Getting Started page for new contributors](https://dotty.epfl.ch/docs/contributing/getting-started.html), +and have a look at some of the [good first issues](https://github.com/lampepfl/dotty/issues?q=is%3Aissue+is%3Aopen+label%3Aexp%3Anovice). +They make perfect entry points into hacking on the compiler. + +We are looking forward to having you join the team of contributors. + +## Library authors: Join our community build + +Dotty now has a set of widely-used community libraries that are built against every nightly Dotty +snapshot. Currently this includes ScalaPB, algebra, scalatest, scopt and squants. +Join our [community build](https://github.com/lampepfl/dotty-community-build) +to make sure that our regression suite includes your library. + +[Scastie]: https://scastie.scala-lang.org/?target=dotty + +[@odersky]: https://github.com/odersky +[@DarkDimius]: https://github.com/DarkDimius +[@smarter]: https://github.com/smarter +[@felixmulder]: https://github.com/felixmulder +[@nicolasstucki]: https://github.com/nicolasstucki +[@liufengyun]: https://github.com/liufengyun +[@OlivierBlanvillain]: https://github.com/OlivierBlanvillain +[@biboudis]: https://github.com/biboudis +[@allanrenucci]: https://github.com/allanrenucci +[@Blaisorblade]: https://github.com/Blaisorblade +[@Duhemm]: https://github.com/Duhemm +[@AleksanderBG]: https://github.com/AleksanderBG +[@milessabin]: https://github.com/milessabin From a26301bb9b3641f7672a2b53b1100df28b263762 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:19:35 +0200 Subject: [PATCH 02/14] fix --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 4f7bba68beb6..2a8894b2383e 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -78,6 +78,11 @@ The above change will allow for more consistency across the code base, as the au To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1. +For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is a work in progress and is not available in this release. + +## `given` clause comes last + + ### Compatibility: the `@alpha` annotation From ac825aeb02d24007ed50c2b2e2ee77d0a43bfd2c Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:30:23 +0200 Subject: [PATCH 03/14] Given clause & type-safe pattern bindings --- ...2019-05-24-15th-dotty-milestone-release.md | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 2a8894b2383e..81b802205480 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -81,9 +81,55 @@ To smoothen the migration, the deprecation warnings will only be emitted if you For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is a work in progress and is not available in this release. ## `given` clause comes last +In the previous release, you could write something like this: +```scala +implied for String = "foo" +def f(x: Int) given (y: String) (z: Int) = x + z +f(1)(3) +``` + +Now, however, `given` clauses must come last: + +```scala +implied for String = "foo" +def f(x: Int)(z: Int) given (y: String) = x + z +f(1)(3) +``` + +This change is done to reduce confusion when calling functions with mixed explicit and implied parameters. + +## Type-safe Pattern Bindings +```scala + val xs: List[Any] = List(1, 2, 3) + val (x: String) :: _ = xs // error: pattern's type String is more specialized + // than the right hand side expression's type Any +``` + +The above code will fail with a compile-time error in Dotty 3.1 and in Dotty 3 with the `-strict` flag. In contrast, in Scala 2, the above would have compiled fine but failed on runtime with an exception. + +Dotty compiler will allow such a pattern binding only if the pattern is *irrefutable* – that is, if the right-hand side conforms to the pattern's type. E.g. the following is OK: + +```scala + val pair = (1, true) + val (x, y) = pair +``` + +If we want to force the pattern binding if the pattern is not irrefutable, we can do so with an annotation: + +```scala + val first :: rest : @unchecked = elems // OK +``` + +The same is implemented for pattern bindings in `for` expressions: + +```scala + val elems: List[Any] = List((1, 2), "hello", (3, 4)) + for ((x, y) <- elems) yield (y, x) // error: pattern's type (Any, Any) is more specialized + // than the right hand side expression's type Any +``` -### Compatibility: the `@alpha` annotation +For the migration purposes, the above change will only take effect in Dotty 3.1 by default. You can use it from Dotty 3 with the `-strict` flag. ## Other changes From 8c0e9109e99a36ab12a64ea7250552f9b1901383 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:36:19 +0200 Subject: [PATCH 04/14] wip --- ...2019-05-24-15th-dotty-milestone-release.md | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 81b802205480..74e54c002c00 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -89,7 +89,17 @@ def f(x: Int) given (y: String) (z: Int) = x + z f(1)(3) ``` -Now, however, `given` clauses must come last: +Now, however, `given` clauses must come last. The above code will fail with: + +``` +-- Error: ../issues/Playground.scala:3:34 -------------------------------------- +3 | def f(x: Int) given (y: String) (z: Int) = x + z + | ^ + | normal parameters cannot come after `given' clauses +one error found +``` + +The following code is the correct way to express the program in question: ```scala implied for String = "foo" @@ -118,7 +128,10 @@ Dotty compiler will allow such a pattern binding only if the pattern is *irrefut If we want to force the pattern binding if the pattern is not irrefutable, we can do so with an annotation: ```scala - val first :: rest : @unchecked = elems // OK +scala> val xs: List[Any] = List("1", "2", "3") + | val (x: String) :: _: @unchecked = xs +val x: String = 1 +val xs: List[Any] = List(1, 2, 3) ``` The same is implemented for pattern bindings in `for` expressions: @@ -131,13 +144,13 @@ The same is implemented for pattern bindings in `for` expressions: For the migration purposes, the above change will only take effect in Dotty 3.1 by default. You can use it from Dotty 3 with the `-strict` flag. +For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html). -## Other changes -Some of the other changes include: +## Other changes +Some of the other notable changes include: -- `infer` method renamed to `the`, the semantics of which is now the same as that of the `the` method of Shapeless. Namely, the implicits are resolved more precisely – see this [gist](https://gist.github.com/milessabin/8833a1dbf7e8245b30f8) for an example in Shapeless, and the Dotty [documentation](http://dotty.epfl.ch/docs/reference/contextual/inferable-params.html#querying-implied-instances) for more details. -- The syntax of quoting and splicing was changed. Now the quoting is expressed via `'{ ... }` and `'[...]` and splicing – via `${...}` and `$id`. Please see the [documentation](http://dotty.epfl.ch/docs/reference/other-new-features/principled-meta-programming.html) for more details on these features. +- Dotty is now fully B # Let us know what you think! From a7f477c502ad5f0451041d3b2f0ba78ea0f1fda8 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:46:13 +0200 Subject: [PATCH 05/14] wip --- ...2019-05-24-15th-dotty-milestone-release.md | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 74e54c002c00..d9bb235dc3d8 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -146,11 +146,32 @@ For the migration purposes, the above change will only take effect in Dotty 3.1 For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html). +## Further improvements to GADT support +In this release, we've further improved our support for Generalised Algebraic Data Types (GADTs). Most notably, we now support variant GADTs: + +```scala +enum Expr[+T] { + case StrLit(s: String) extends Expr[String] + case Pair[A, B](a: Expr[A], b: Expr[B]) extends Expr[(A, B)] +} + +def eval[T](e: Expr[T]): T = e match { + case Expr.StrLit(s) => s + case Expr.Pair(a, b) => (eval(a), eval(b)) +} +``` + +We've also plugged a few soundness problems caused by inferring too much when matching on abstract, union and intersection types. + ## Other changes -Some of the other notable changes include: +Some of the other notable changes include the following: + +- Dotty is now fully boostrapped. This means that we are able to compile Dotty with Dotty itself, and hence use all the new features in the compiler code base. +- Singletones are now allowed in union types. E.g. the following is allowed: `object foo; type X = Int | foo.type`. +- A bunch of improvements was made for the type inference system – see, e.g., PRs [#6454](https://github.com/lampepfl/dotty/pull/6454) and [#6467](https://github.com/lampepfl/dotty/pull/6467). +- Improvements to the Scala 2 code support which, in particular, improves Cats support – see PRs [#6494](https://github.com/lampepfl/dotty/pull/6494) and [#6498](https://github.com/lampepfl/dotty/pull/6498). -- Dotty is now fully B # Let us know what you think! @@ -162,36 +183,10 @@ If you have questions or any sort of feedback, feel free to send us a message on Thank you to all the contributors who made this release possible! -According to `git shortlog -sn --no-merges 0.13.0-RC1..0.14.0-RC1` these are: +According to `git shortlog -sn --no-merges 0.14.0-RC1..0.15.0-RC1` these are: ``` - 214 Martin Odersky - 151 Nicolas Stucki - 71 Liu Fengyun - 53 Guillaume Martres - 26 Olivier Blanvillain - 10 Aleksander Boruch-Gruszecki - 9 Aggelos Biboudis - 6 Miles Sabin - 4 Allan Renucci - 4 Dale Wijnand - 3 Anatolii Kmetiuk - 2 Fengyun Liu - 2 Alex Zolotko - 1 gnp - 1 tim-zh - 1 Dmitry Petrashko - 1 Dotty CI - 1 Jasper Moeys - 1 Jentsch - 1 Jim Van Horn - 1 Lionel Parreaux - 1 Master-Killer - 1 Olivier ROLAND - 1 Robert Stoll - 1 Seth Tisue - 1 Tomasz Godzik - 1 Victor +TODO ``` If you want to get your hands dirty and contribute to Dotty, now is a good time to get involved! @@ -223,3 +218,4 @@ to make sure that our regression suite includes your library. [@Duhemm]: https://github.com/Duhemm [@AleksanderBG]: https://github.com/AleksanderBG [@milessabin]: https://github.com/milessabin +[@anatoliykmetyuk]: https://github.com/anatoliykmetyuk From 48774aa293936469b38a628be0638b4b94233b6e Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:56:37 +0200 Subject: [PATCH 06/14] wip --- ...2019-05-24-15th-dotty-milestone-release.md | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index d9bb235dc3d8..042d7b82219d 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -6,7 +6,7 @@ authorImg: /images/anatolii.png date: 2019-05-24 --- -Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of improvements +Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more. This release serves as a technology preview that demonstrates new language features and the compiler supporting them. @@ -27,12 +27,12 @@ You can learn more about Dotty on our [website](https://dotty.epfl.ch). -This is our 14th scheduled release according to our -[6-week release schedule](https://dotty.epfl.ch/docs/usage/version-numbers.html). +This is our 15th scheduled release according to our +[6-week release schedule](https://dotty.epfl.ch/docs/contributing/release.html). # What’s new in the 0.15.0-RC1 technology preview? ## Operator Rules -This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. +This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. This ability will help to make code bases more consistent in the way the calls to methods are performed. Methods with symbolic names like `+` are allowed to be used in an infix position by default: @@ -44,7 +44,7 @@ scala> Foo(1) + Foo(2) val res0: Int = 3 ``` -Methods with alphanumeric names are not allowed to be used in an infix position by default. Breaking this constraint will raise a deprecation warning: +Methods with alphanumeric names are not allowed to be used in an infix position. Breaking this constraint will raise a deprecation warning: ```scala scala> case class Foo(x: Int) { def plus(other: Foo) = x + other.x } @@ -62,7 +62,7 @@ scala> Foo(1).plus(Foo(2)) val res2: Int = 3 ``` -As the warning says, if you want the users of your library to be able to use it in an infix position, you can do so as follows: +As the warning says, if you want the users of the method to be able to use it in an infix position, you can do so as follows: ```scala scala> import scala.annotation.infix @@ -74,11 +74,9 @@ scala> Foo(1) plus Foo(2) val res3: Int = 3 ``` -The above change will allow for more consistency across the code base, as the author of a method is able to make a decision on how the method is supposed to be called. - To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1. -For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is a work in progress and is not available in this release. +For more information, see the the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is planned for the future and is not available in this release. ## `given` clause comes last In the previous release, you could write something like this: @@ -99,7 +97,7 @@ Now, however, `given` clauses must come last. The above code will fail with: one error found ``` -The following code is the correct way to express the program in question: +The following snippet is the correct way to express the program in question: ```scala implied for String = "foo" @@ -107,7 +105,7 @@ def f(x: Int)(z: Int) given (y: String) = x + z f(1)(3) ``` -This change is done to reduce confusion when calling functions with mixed explicit and implied parameters. +We changed this to reduce confusion when calling functions with mixed explicit and implied parameters. ## Type-safe Pattern Bindings ```scala @@ -128,10 +126,8 @@ Dotty compiler will allow such a pattern binding only if the pattern is *irrefut If we want to force the pattern binding if the pattern is not irrefutable, we can do so with an annotation: ```scala -scala> val xs: List[Any] = List("1", "2", "3") - | val (x: String) :: _: @unchecked = xs -val x: String = 1 -val xs: List[Any] = List(1, 2, 3) + val xs: List[Any] = List("1", "2", "3") + val (x: String) :: _: @unchecked = xs ``` The same is implemented for pattern bindings in `for` expressions: @@ -142,12 +138,12 @@ The same is implemented for pattern bindings in `for` expressions: // than the right hand side expression's type Any ``` -For the migration purposes, the above change will only take effect in Dotty 3.1 by default. You can use it from Dotty 3 with the `-strict` flag. +For the migration purposes, the above change will only take effect in Dotty 3.1. You can use it in Dotty 3 with the `-strict` flag. For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html). -## Further improvements to GADT support -In this release, we've further improved our support for Generalised Algebraic Data Types (GADTs). Most notably, we now support variant GADTs: +## Further improvements to Generalised Algebraic Data Types (GADTs) support +In this release, we've further improved our support for GADTs. Most notably, we now support variant GADTs: ```scala enum Expr[+T] { From b03720cef1b3cc52c4ed9fcf1f49792aa5169124 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:58:02 +0200 Subject: [PATCH 07/14] Fix title --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 042d7b82219d..1405b38c42b4 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -1,6 +1,6 @@ --- layout: blog-page -title: Announcing Dotty 0.15.0-RC1 with TODO +title: Announcing Dotty 0.15.0-RC1 with the new infix operator rules, type safe pattern bindings and more author: Anatolii Kmetiuk authorImg: /images/anatolii.png date: 2019-05-24 From 3dfc3230f3bf586d91a5c2a93a167da107a703b5 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 21 May 2019 18:58:43 +0200 Subject: [PATCH 08/14] spacing fixed --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 1405b38c42b4..8b2db148a7e0 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -159,7 +159,6 @@ def eval[T](e: Expr[T]): T = e match { We've also plugged a few soundness problems caused by inferring too much when matching on abstract, union and intersection types. - ## Other changes Some of the other notable changes include the following: @@ -168,7 +167,6 @@ Some of the other notable changes include the following: - A bunch of improvements was made for the type inference system – see, e.g., PRs [#6454](https://github.com/lampepfl/dotty/pull/6454) and [#6467](https://github.com/lampepfl/dotty/pull/6467). - Improvements to the Scala 2 code support which, in particular, improves Cats support – see PRs [#6494](https://github.com/lampepfl/dotty/pull/6494) and [#6498](https://github.com/lampepfl/dotty/pull/6498). - # Let us know what you think! If you have questions or any sort of feedback, feel free to send us a message on our From ec90a57f749e961af782644a54c07e9b89ec5eb4 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Wed, 22 May 2019 11:32:20 +0200 Subject: [PATCH 09/14] typo fix --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 8b2db148a7e0..4f79aa3bf465 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -163,7 +163,7 @@ We've also plugged a few soundness problems caused by inferring too much when ma Some of the other notable changes include the following: - Dotty is now fully boostrapped. This means that we are able to compile Dotty with Dotty itself, and hence use all the new features in the compiler code base. -- Singletones are now allowed in union types. E.g. the following is allowed: `object foo; type X = Int | foo.type`. +- Singletons are now allowed in union types. E.g. the following is allowed: `object foo; type X = Int | foo.type`. - A bunch of improvements was made for the type inference system – see, e.g., PRs [#6454](https://github.com/lampepfl/dotty/pull/6454) and [#6467](https://github.com/lampepfl/dotty/pull/6467). - Improvements to the Scala 2 code support which, in particular, improves Cats support – see PRs [#6494](https://github.com/lampepfl/dotty/pull/6494) and [#6498](https://github.com/lampepfl/dotty/pull/6498). From 9bb0de88f10607baa1e084d18514da3a0ff9f8b6 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Wed, 22 May 2019 13:33:10 +0200 Subject: [PATCH 10/14] Dotty 3 -> Scala 3 --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 4f79aa3bf465..2cecbdb5cc4f 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -74,7 +74,7 @@ scala> Foo(1) plus Foo(2) val res3: Int = 3 ``` -To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Dotty 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Dotty 3.1. +To smoothen the migration, the deprecation warnings will only be emitted if you compile with the `-strict` flag under Scala 3. Alphanumeric methods that are defined without the `@infix` annotation used in an infix position will be deprecated by default starting with Scala 3.1. For more information, see the the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/operators.html#the-infix-annotation). Note that the `@alpha` annotation also described in the documentation is planned for the future and is not available in this release. @@ -114,7 +114,7 @@ We changed this to reduce confusion when calling functions with mixed explicit a // than the right hand side expression's type Any ``` -The above code will fail with a compile-time error in Dotty 3.1 and in Dotty 3 with the `-strict` flag. In contrast, in Scala 2, the above would have compiled fine but failed on runtime with an exception. +The above code will fail with a compile-time error in Scala 3.1 and in Scala 3 with the `-strict` flag. In contrast, in Scala 2, the above would have compiled fine but failed on runtime with an exception. Dotty compiler will allow such a pattern binding only if the pattern is *irrefutable* – that is, if the right-hand side conforms to the pattern's type. E.g. the following is OK: @@ -138,7 +138,7 @@ The same is implemented for pattern bindings in `for` expressions: // than the right hand side expression's type Any ``` -For the migration purposes, the above change will only take effect in Dotty 3.1. You can use it in Dotty 3 with the `-strict` flag. +For the migration purposes, the above change will only take effect in Scala 3.1. You can use it in Scala 3 with the `-strict` flag. For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html). From 6ac7e5c27fe2174f01a877aed54cee0303689646 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Wed, 22 May 2019 13:37:07 +0200 Subject: [PATCH 11/14] More stress on full bootstrap --- .../blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 2cecbdb5cc4f..d624b3cb4838 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -1,12 +1,14 @@ --- layout: blog-page -title: Announcing Dotty 0.15.0-RC1 with the new infix operator rules, type safe pattern bindings and more +title: Announcing Dotty 0.15.0-RC1 – the fully bootstrapped compiler author: Anatolii Kmetiuk authorImg: /images/anatolii.png date: 2019-05-24 --- -Hi! In this article, we'd like to announce the 15th release of Dotty. With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more. +Hi! In this article, we'd like to announce the 15th release of Dotty. The most exciting thing in this release is the full bootstrap for Dotty introduced by PR [#5923](https://github.com/lampepfl/dotty/pull/5923). This means that we are able to compile Dotty with Dotty itself, and hence use all the new features in the compiler code base. + +With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more. This release serves as a technology preview that demonstrates new language features and the compiler supporting them. @@ -162,7 +164,6 @@ We've also plugged a few soundness problems caused by inferring too much when ma ## Other changes Some of the other notable changes include the following: -- Dotty is now fully boostrapped. This means that we are able to compile Dotty with Dotty itself, and hence use all the new features in the compiler code base. - Singletons are now allowed in union types. E.g. the following is allowed: `object foo; type X = Int | foo.type`. - A bunch of improvements was made for the type inference system – see, e.g., PRs [#6454](https://github.com/lampepfl/dotty/pull/6454) and [#6467](https://github.com/lampepfl/dotty/pull/6467). - Improvements to the Scala 2 code support which, in particular, improves Cats support – see PRs [#6494](https://github.com/lampepfl/dotty/pull/6494) and [#6498](https://github.com/lampepfl/dotty/pull/6498). From 85358b758d23129835b9282416006b7c4ee220bc Mon Sep 17 00:00:00 2001 From: Anatolii Date: Wed, 22 May 2019 18:39:52 +0200 Subject: [PATCH 12/14] fixes --- .../blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index d624b3cb4838..8799143c75f4 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -6,7 +6,7 @@ authorImg: /images/anatolii.png date: 2019-05-24 --- -Hi! In this article, we'd like to announce the 15th release of Dotty. The most exciting thing in this release is the full bootstrap for Dotty introduced by PR [#5923](https://github.com/lampepfl/dotty/pull/5923). This means that we are able to compile Dotty with Dotty itself, and hence use all the new features in the compiler code base. +Hi! We are very excited to announce the 15th release of Dotty. The most exciting thing in this release is the full bootstrap for Dotty introduced by PR [#5923](https://github.com/lampepfl/dotty/pull/5923)🎉😍. This means that we are able to compile Dotty with Dotty itself, hence use all the new features in the compiler code base. With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more. @@ -33,6 +33,11 @@ This is our 15th scheduled release according to our [6-week release schedule](https://dotty.epfl.ch/docs/contributing/release.html). # What’s new in the 0.15.0-RC1 technology preview? +## Full Bootstrap +Bootstrapping Dotty is a big milestone for us and in compiler construction in general. Firstly, we feel more confident that our compiler works as is (even without reusing the new features). Secondly, in the immediate future, we will be able to reuse many of the features that dotty proposes within dotty itself. For example, we have no fewer than 2641 occurrences of the text string (implicit ctx: Context) in the compiler that we can scrap with [Contextual Function types](https://www.scala-lang.org/blog/2016/12/07/implicit-function-types.html). Big milestones have high risk/high gain and we must be attentive. That is the reason that we will wait a bit until we start using new features. Consequently, at the moment we cross-compile the build with 2.12 on the CI so that we don't accidentally start using Dotty features in case we need to revise the bootstrap process (we'll start using Dotty features eventually, but let's wait until we're confident that this setup works well enough). + +Check the following for more information [#5923 (comment)](https://github.com/lampepfl/dotty/pull/5923#issuecomment-485421148) and please let us know if you have any incremental compilation issues or anything else! + ## Operator Rules This change addresses the problem of the regulation of whether an operator is supposed to be used in an infix position. The motivation is for the library authors to be able to enforce whether a method or a type is supposed to be used in an infix position by the users. This ability will help to make code bases more consistent in the way the calls to methods are performed. From 04865a75179573f9767230d3b5bf6fe1206fe8dd Mon Sep 17 00:00:00 2001 From: Anatolii Date: Wed, 22 May 2019 18:43:11 +0200 Subject: [PATCH 13/14] fixes --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index 8799143c75f4..c99cc8d90df2 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -6,7 +6,7 @@ authorImg: /images/anatolii.png date: 2019-05-24 --- -Hi! We are very excited to announce the 15th release of Dotty. The most exciting thing in this release is the full bootstrap for Dotty introduced by PR [#5923](https://github.com/lampepfl/dotty/pull/5923)🎉😍. This means that we are able to compile Dotty with Dotty itself, hence use all the new features in the compiler code base. +Hi! We are very excited to announce the 15th release of Dotty. The most exciting thing in this release is the full bootstrap for Dotty introduced by PR [#5923](https://github.com/lampepfl/dotty/pull/5923)🎉😍. This means that we now always compile Dotty with Dotty itself, hence we can use use all the new features in the compiler code base. With this release comes a bunch of new features and improvements, such as the ability to enforce whether an operator is intended to be used in an infix position, the type safe pattern bindings and more. From a3ffc2f785c4b9a5730441d1c45c3df13fb4aaba Mon Sep 17 00:00:00 2001 From: Anatolii Date: Thu, 23 May 2019 11:13:24 +0200 Subject: [PATCH 14/14] PR and issue references in the GADT paragraph --- docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md index c99cc8d90df2..7000ee1ea876 100644 --- a/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md +++ b/docs/blog/_posts/2019-05-24-15th-dotty-milestone-release.md @@ -150,7 +150,7 @@ For the migration purposes, the above change will only take effect in Scala 3.1. For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html). ## Further improvements to Generalised Algebraic Data Types (GADTs) support -In this release, we've further improved our support for GADTs. Most notably, we now support variant GADTs: +In this release, we've further improved our support for GADTs. Most notably, we now support variant GADTs, thus fixing [#2985](https://github.com/lampepfl/dotty/issues/2985): ```scala enum Expr[+T] { @@ -164,7 +164,7 @@ def eval[T](e: Expr[T]): T = e match { } ``` -We've also plugged a few soundness problems caused by inferring too much when matching on abstract, union and intersection types. +We've also plugged a few soundness problems (e.g. [#5667](https://github.com/lampepfl/dotty/issues/5667)) caused by inferring too much when matching on abstract, union and intersection types. For more information, see PR [#5736](https://github.com/lampepfl/dotty/pull/5736). ## Other changes Some of the other notable changes include the following: