Large developer-facing change pushed

Skip to first unread message

David Hall

Apr 12, 2021, 7:56:22 PM4/12/21
Hi everyone,

In preparation for the upgrade to Scala 3, which I will now try to support properly, I have switched the code generation framework from Scala Macro Paradise Annotations to one based on Scala Meta. I believe it should maintain backwards compatibility, even at a binary level, but it's possible a few small things got messed up. Tests are all still happy, or as happy as they usually are, I guess.

This change should not impact users of the library, just people doing development, which I believe is a fairly small number of people.

Let me know if you have any questions or concerns.

-- David

I added a file to give an overview, which I will paste below.

## Notes on Code Generation

TL;DR: Add math/src/main/codegen as a sources root in intellij.

NOTE: If someone knows how to make that happen automatically I'd appreciate it.

Breeze makes fairly extensive use of code generation to achieve a lot of its performance.
In particular, we use the `@expand` annotation to generate optimized implementations for various languages
numeric and linear algebra operations. Until April 2021, `@expand` was implemented via a macro annotation.
However, Scala 3 will not support macro annotations, and I (@dlwh) don't particularly want to support two versions
of the codebase. Nor do I want to check in a whole bunch of generated code for when we inevitably change things later.

So I'm using [Scala Meta]( instead to do explicit source generation.
Scala Meta was relatively easy to drop in for macro annotations modulo some annoying differences, though there were a bunch of issues. I think it
may have been wiser to switch to Scalafix.

The pre-generated files live in `math/src/main/codegen`. I wrote a janky SBT plugin that
contains the ported unrolling logic at

Marcel Luethi

Apr 13, 2021, 2:06:30 AM4/13/21
Dear David

It is absolutely awesome that breeze will have proper support for Scala 3.0.

After having been using Scala for about 6 years for developing scientific applications, I still find it amazingly productive, especially when the intention is to go beyond the prototype stage.
My hope is that with Scala 3, and projects such as Graal VM, we can build new momentum for using Scala in the scientific community. Libraries such as breeze are crucial for this to even get started.

Thanks again for all the great work.

Best wishes


You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages