Scala 3 porting experiences

Motto: Slow down, you move too fast

I am in process of migrating my project from Scala 2.13 to Scala 3 for almost two years. The process is often painful and unpleasant. I have encountered (and reported) multiple issues in the compiler, various libraries and IDE. After the issue is fixed or workaround found, which usually takes weeks to months, another issue comes to surface.

Currently I am at the point the Scala 3 version of my project is mostly usable, but some parts of it still need to be run using Scala 2 (some builds tools and tests), because Scala 3 versions of some libraries are not mature enough to be usable (usually those are libraries using macros for reflection).

Recently I have checked the 3.4 release and besides of the usual problems I am reported numerous deprecations (infix methods, underscores). Because I still need to be able to cross-compile, I cannot use infix modifiers or the question mark syntax, as suggested by the error message.

Perhaps my project is a bit unusual (an application using OpenGL, Swing and some other desktop technologies), but I do not consider it to be unusually advanced or large one. Still the problems I face are numerous. Seeing the 3.4 being concentrated on deprecations, I feel afraid that before I finish my porting to Scala 3, cross compilation with Scala 2 will become unpractical.

I would like to ask the responsible people to consider concentrating more on making the things we already have (compiler, libraries, build tools, IDEs) to be really usable than to sail fast forward to a bright future, leaving poor blokes like me behind.

I do not have much hope a single “rant” like this will change anything, but perhaps there are more people with a similar experience?

1 Like

I would like to ask the responsible people to consider concentrating more on making the things we already have (compiler, libraries, build tools, IDEs) to be really usable than to sail fast forward to a bright future, leaving poor blokes like me behind.

This is what we try to do in in Scala LTS (3.3.x). I wouldn’t recommend moving to 3.4.x or even further in the future just yet if there is no particular need for it. We port all the nice improvements and bugfixes to the 3.3.x branch, so that people can stay on it and not be left behind. We also improve the overall tooling with LTS especially in mind.

Some of the changes needed for 3.4.x have automatic rewrites in the compiler and if not we can add them so that the migration is much easier once people need to move off the LTS, which would probably need to happen for the next LTS or if some feature was added that people wanted.

3 Likes

That is great (I really mean it. I was not aware of that and it answers most of my concerns)

Now it remains to be seen how long it will take before the issues are solved (3.3.2?, 3.3.3?). With a little luck I may have a fully working Scala 3 project in another year. (Sorry for the slight sarcasm, but the porting effort does feels a bit frustrating.)

2 Likes

The LTS info is here it is supported for 3 years.

There is also the option to declare syntax version to ease source incompatibility / deprecation issues, which can possibly buy more time.

1 Like

(not sure if this suggestion has already been made somewhere? if so, link?)

Although all of the new warnings in 3.4 are of course configurable and suppressible, perhaps the compiler could offer a single flag maintainers could pass that says “I’m crossbuilding, don’t warn me about anything that isn’t actionable in a crossbuilt project”.

We’re moving in that direction on the Scala 2 side. Distinguish between `-Xsource:3` (for preparing to switch to 3) and `-Xsource:3-cross` (for crossbuilding on 2 and 3) by som-snytt · Pull Request #10573 · scala/scala · GitHub , which we expect to land in time for 2.13.13, will add -Xsource:3-cross (or some such name, name not settled on yet), specifically intended for use in crossbuilt projects.

3 Likes