(The Scala Org aims to release Scala 3 by the end of fall 2020. We are about 15 employees (some of whom work part-time), spread in 4 organisations (+ active community members), focusing on finalising 52 essential projects in 6 months. Project leads publish the road-maps under the category “Scala 3 release projects” to share with you what is to be expected and hopefully get your advice & contributions as well. All the projects’ road-maps come after an extensive feedback gathering, rounds of discussion, and involvement of major stakeholders, we now need the community to help push this effort over the line. Your collaboration is highly appreciated, thank you in advance!)
Documenting Scala 3
All programming languages need a doctool, and Scala 3 is no exception.
Our plan (temporary codename : Scala3doc) is to write a tool that leverages APIs Scala 3 already exposes (namely, Tasty Reflect) to cleanly hook into compiler knowledge. In order to actually generate documentation, we will hook into Dokka, which already can generate documentation for Java and Kotlin.
We have two primary reasons for depending on Dokka. One of them is division of labour - Dokka already has a team of maintainers, and it supports an excellent API which already allowed us to quite easily generate documentation. By depending on Dokka, we will be able to share a large portion of the maintenance burden. The second reason is very pragmatic - on our own, it’d be difficult for us to reach even feature parity with Scaladoc, simply because of workforce constraints. Meanwhile, Dokka maintainers from VirtusLab reached out to us with an offer of help, which we were happy to take.
With Scala3doc, we will be taking the opportunity to add some new and exciting features to Scaladoc.
First off: we will be adding support for writing docs in Markdown. Since Scaladoc was written, the Wiki syntax started to look positively esoteric compared to how ubiquitous Markdown became, so an update here is sorely needed. Of course, we won’t be forcing everyone to change their comments before they can see any documentation output - old Wiki syntax will be supported as well.
This brings us to the second addition: Scala3doc will also support adding project-level documentation in the form of Markdown files. This is a surprisingly common use-case that suprisingly few documentation tools support. As an example from our own backyard, take a look at the documentation of Future: it links to a separate document explaining the high-level concepts behind futures and promises! Another example: Cats’ documentation features many pages explaining high-level concepts behind FP in Scala. With Scala3doc, everyone will be able to define Markdown documentation alongside their project, link from this documentation to API documentation and back again, and easily display both together, as many projects want to and already do.
Finally, Dokka has an early-stage support for plugins and by depending on Dokka, we should be able to have such a support as well. This would enable the Scala community to write plugins that would extend functionality of Scala3doc. While this is Scala3doc 2.0 material, we could potentially support plugins that extend our capabilities for simple static site generation, adjust the appearance of the output or even add new features such as Latex snippets.
Quick summary is: status is good!
We already have a PoC-level implementation at https://github.com/lampepfl/scala3doc.
We can generate a reasonable version (especially reasonable given that the work started around a month ago!) of Dotty’s website, which you can see here. We also can generate the project docs. Finally, you can also see our own docs.
We already can document many kinds of definitions that Scala supports, such as classes, traits, objects, vals, vars, defs as well as top-level definitions. This includes generating signatures for each of the above with links to appropriate pages.
We support both Wiki and Markdown syntaxes, as well as basic link resolution.
Finally, since we depend on Dokka to generate our documentation, we also get a variety of utility features such as search and tree-based documentation explorer.
We still have some work ahead of us! Here are milestones we need to reach:
Publish an initial version of the tool together with an SBT plugin
Replace Dottydoc as the dedicated tool for documenting Dotty code
- fully supporting Dotty’s current documentation pages, including the blog
- releasing together with Dotty as the dedicated documentation tool
Support all kinds of Dotty definition and generate documentation for the standard library
Reach feature parity with Scaladoc
Can I help?
First off: we’re happy that you want to! You can:
We have two issue labels you should take a look at:
good first issueand
self-contained. First is easy pickings: you’ll be able to contribute without needing to dive too deep into the project. Second is reverse: it’s an issue that’s probably interesting, complex and self-contained enough that you can continue chipping away at it without needing to worry too much about merge conflicts.
Run the tool on your codebase!
Our first milestone is to publish an SBT plugin that’d allow the community to easily generate documentation for their projects. Once we’re there, we’ll be very happy to hear your feedback and also receive the inevitable bug reports!
So far, we’ve been working on Scala3doc in a team of 3 people: Aleksander Boruch-Gruszecki (me), Krzysztof Romanowski and Filip Zybała. Krzysztof and Filip are affiliated with VirtusLab. I’d like here to thank Krzysztof and Filip for their work, and Krzysztof specifically for involving VirtusLab with the project - if it wasn’t for him, the project could not possibly be where it is right now.
I’d also like to give a shoutout to Guillaume Raffin / TheElectronWill, who has offered to help us with the frontend appearance of the documentation.
Finally, I’d like to thank Bryan Abate, Felix Mulder and Martin Duhem, authors of two previous iterations of Scala3doc - Tastydoc and Dottydoc. Experience and ideas from those two projects have helped us in this latest attempt at a documentation tool