Large developer-facing change pushed

17 views
Skip to first unread message

David Hall

unread,
Apr 12, 2021, 7:56:22 PM4/12/21
to scala-...@googlegroups.com
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 DEVELOP.md 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](https://github.com/scalameta/scalameta) 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 https://github.com/dlwh/sbt-breeze-expand-codegen.

Marcel Luethi

unread,
Apr 13, 2021, 2:06:30 AM4/13/21
to scala-...@googlegroups.com
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

Marcel






--
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 scala-breeze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-breeze/CALW2ey1iBNJ1-ARhbXaWaH1V3bNr36NPRFzemquKjz8P%2BGv5Uw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages