Improved main methods coming along

Mark "Justin" Waks
1 min readNov 16, 2021

Taking a brief break from A Philosophy of Testing for a little bit of good old-fashioned Dotty news:

This morning, I noticed this Draft PR, titled “Generalize main annotations”. That’s pretty exciting. One of the nice features of Scala 3 is the new @mainannotation, which allows you to more-easily create application entry points, as documented here. But that annotation in its original form is good, but not great — when compared to something like Ammonite, it is notably lacking in the details.

This PR seems to go a long ways towards making up that ground. It’s an enormous PR (although most of the changes appear to be boilerplate tweaks to existing tests), but the most interesting stuff for the non-compiler-expert is in the test section, including tidbits like:

Overall, it’s pretty neat — increasingly, the @main annotation works the way you would intuitively expect it to, and just “does the right thing”.

Usual caveat for Dotty news: this is just a draft PR, nowhere near merged into the mainline, much less released yet. But it realizes a promise made by the team some time back, to make @main more generally useful and ergonomic, so it will hopefully make it to a Scala 3 release near you before too terribly long.

--

--

Mark "Justin" Waks

Lifelong programmer and software architect, specializing in online social tools and (nowadays) Scala. Architect of Querki (“leading the small data revolution”).