Skip to content

Blog post on Scala 3 #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 20, 2018
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions blog/_posts/2018-04-18-scala-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
layout: blog-detail
post-type: blog
by: Martin Odersky
title: "Towards Scala 3"
---

Now that Scala 2.13 is around the corner, it's time to consider the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "around the corner" is not the right wording. There is still M4, then M5, then RC1. I would not consider 2.13 "around the corner" until RC1 is out. I think you might simply omit the whole sentence, and then in the "When will it come out?" section, insert "Scala 2.13 will come out later this year."

roadmap beyond it. It's been no secret that the work on Dotty over the
last 5 years was intended to explore what a new Scala could look
like. We are now at a stage where we can commit: Dotty will become
Scala 3.0.

Of course, this statement invites many follow-up questions. Here are
some answers we can already give today. We expect there will be more
questions and answers as things shape up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have repeatedly encountered a persistent misconception among new and/or occasional Scala users that Dotty is somehow a new language. I suggest leading with a "How different are Scala 2 and Scala 3?" section that emphasizes continuity. Perhaps beginning with something like "Scala 2 and Scala 3 are fundamentally the same language. The compiler is new, but nearly everything Scala programmers already know about Scala 2 applies to Scala 3 as well, and most ordinary Scala 2 code will also work on Scala 3 with only minor changes."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I have added that wording.

_When will it come out?_

The intent is to publish the final Scala 3.0 soon after Scala 2.14. At the
current release schedule (which might still change), that means late
2019 or early 2020.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no delays, we'll have 2.13 mid 2018, which means 2.14 early 2020, so "late 2019" is ambitious for 3.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I was wondering about that as well, I should have said something.


_What is Scala 2.14 for?_

Scala 2.14's main focus will be on smoothing the migration to Scala
3. It will do this by defining migration tools, shim libraries, and
targeted deprecations, among others.

_What's new 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a general audience, better "statically typed" than just "typed", IMO. people coming from dynamic languages don't necessarily consider their languages not to be "typed".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer "typed". It's a matter to take back terminology to what it should mean.

realizing 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 behavior,
- build on strong foundations to ensure the design hangs well together,
- remove some language constructs that proved to be not essential,
- include some new constructs that improve the language’s consistency, safety, ergonomics, and performance.

The main language changes, either implemented or projected, are listed
in the [Reference section on the Dotty website](http://dotty.epfl.ch/docs/reference/overview.html).
Many of the new features will be submitted to the SIP process, subject to
approval.

_What about migration?_

Scala 3 is neither source nor binary compatible with Scala 2. However:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggested wording: "As with previous Scala upgrades, Scala 3 is not binary compatible with Scala 2. They are mostly source compatible, but differences exist." simply saying "not source compatible" sounds more alarming than necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.



- Scala 3 code can link against Scala 2 artifacts (Scala 2.12 and upwards).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really unclear — you just said they aren't binary compatible, but now they kind of are? In fact, it sounds like Scala 3 and 2 are more binary compatible than e.g. 2.11 and 2.12 were?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if this feature is mentioned, it needs to be explained; what does it do, how does it work, how is it useful? (I personlly don't understand what it is).

- Scala 3 and Scala 2 share the same standard library.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps "standard library sources" so it's clear they aren't the same JAR (or are they? the previous bullet leaves the reader in doubt about that)

- With some small tweaks it is possible to cross-build code for both Scala 2 and 3.
We will work on a guide defining the shared language subset that can be compiled under both versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "We will work on", suggest the more confident "We will provide"

- The Scala 3 compiler has a `-language:Scala2` option that lets it compile most Scala 2 code
and at the same time highlights necessary rewritings as migration warnings.
- The compiler can perform many of the rewritings automatically using a `-rewrite` option.
- Migration through automatic rewriting will also be offered through the `scalafix` tool,
which does not require Scala 3 to be installed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems peculiar and is perhaps an unnecessary level of detail. If I'm migrating to Scala 3 anyway, why do I care if this particular step doesn't require Scala 3 to be present?


_What’s the expected state of tool support?_

- Compiler: The Scala 3 compiler `dotc` has been used to compile itself and a growing set of libraries for a number of years now.
- IDEs: IDE support is provided by having `dotc` implement LSP, the Language Server Protocol,
including standard operations such as completion and hyperlinking and more advanced ones
such as find references or rename. There’s a VS Code plugin incorporating these operations.
Jetbrains has also released a first version of Dotty support in their Scala plugin,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Jetbrains/JetBrains/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider writing "Scala 3" here instead of "Dotty"

and we hope to work with them on further improvements.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/hope/intend/

- REPL: A friendly REPL is supported by the compiler
- Docs: A revamped ScalaDoc tool generates docs for viewing in a browser and (in the future) also in the IDE..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ScalaDoc/Scaladoc/

- Build tools: There is a Dotty/Scala 3 plugin for sbt, and we will also work on Scala 3 integration in other build tools.

_What about stability?_

- A community build contains some initial open source projects that are compiled nightly using Scala 3.
We plan to add a lot more projects to the build between now and the final release.
- We plan to use the period of developer previews to ensure that core projects are published for Scala 3.
- We have incorporated most of the Scala 2 regression tests in the Scala 3 test suite and will keep including new tests.
- In the near future we plan to build all Scala 3 tools using a previous version of the `dotc` compiler itself.
So far all tools are built first with the current Scala compiler and then again with `dotc`.
Basing the build exclusively on Scala 3 has the advantage that it lets us “eat our own dog food”
and try out the usability of Scala 3’s new language feature on a larger scale.

_When can I try it out?_

You can start working with Dotty now. See the getting started
guide. Dotty releases are published every 6 weeks. We expect to have
developer previews for Scala 3.0 in the first half of 2019.

_What about macros?_

Stay tuned! We are about to release another blog post specifically
about that issue.

_How can I help?_

Scala 3 is developed completely in the open at
[https://github.com/lampepfl/dotty]. Get involved there, by fixing and
opening issues, making pull requests, and participating in the
discussions.