A few Dotty things going on

I’ve been busy with other things lately, so haven’t been paying as much attention to the Dotty News column. And really, you would think that not much would be happening in Dotty right now, as things move towards release. But there’s still some ferment, so here are a few of the more interesting things currently going on.

In general, Martin has been trying to reduce the number of strange uses of _ in Dotty. We’re all familiar with the fact that Scala uses underscore as what I usually call the “enh” operator — it’s used for a wide variety of use cases where you don’t need a name, and while it is convenient to not have to remember specialized names for all those cases, it can be confusing as heck for people who are learning the language when they encounter a dozen different usages of _.

One example of the push to reduce that can be found in this PR, which deals with this unusual but not entirely rare use case:

var x: T = _

If you’re not familiar with it, this is how you say that x is uninitialized. (Yes, that’s legal, and occasionally necessary, although I recommend avoiding it whenever possible.)

The proposed change is to replace this use of underscore with a new uninitialized function. In general, this seems to be a sensible improvement, but we’ll see whether it makes it into 3.0.

(In general, it is Very Very Late to be making language changes for 3.0, and every change is controversial by definition — many of the current debates at the moment are less “should we make this change?” and more “do we really need to do this now?”. But some tweaks are still making it in.)

Similarly, and much more importantly, there is this PR to change the import syntax from

import foo._

to

import foo.*

and from

import foo.{bar => baz}

to

import foo.bar as baz

In and of themselves, I love these changes. I’ve been pronouncing it as “import foo-dot-star” for as long as I’ve been programming in Scala, since that is what most other languages do, and there is no good reason for Scala to be a special snowflake in this. And the use of the as keyword here seems relatively intuitive and easier to learn.

That said, this is a seriously high-impact change, especially this late before 3.0. It’s plausible only because the old syntax is still supported, so it won’t entirely upset the applecart, but if any major snags are found, I would expect this to be pushed to 3.1.

If you haven’t checked out the DottyDocs recently, I recommend giving them a look. They’re built on top of a new engine, which I believe will be the replacement for ScalaDoc in 3.0.

In particular, if you dig down there, you’ll find that it now includes the standard library, which has not been true for the DottyDocs site until recently. So you can get a sense of what the real everyday documentation is going to look like.

It’s still very much a work in progress, with PRs coming fast and thick, but it’s starting to look pretty good.

Not related to the language itself, but if you haven’t heard: the Scala Center has been hard at work on a major rewrite of the Scala courses on Coursera, to update them for Scala 3. My understanding from the team is that the new release of the courses will come out shortly after the new version of the language, so those of you who prefer that mode of learning, and are excited to jump in, may want to plan out some time for that.

Obviously, Scala 3.0 isn’t coming out in February — the schedule has slipped a bit from the original plans. But it’s still steaming along, and isn’t way behind. Based on the current state of play, my bet is that the final release of 3.0 will be some time in May, but obviously that’s just a guess. I’ll try to keep y’all informed as things solidify…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store