ScalaFX 16.0.0-R22 released

51 views
Skip to first unread message

Jarek

unread,
Apr 22, 2021, 8:14:13 PM4/22/21
to ScalaFX Users
The two main features of this release is support for Scala 3 (RC3) and JavaFX 16. More details are in the Release Notes.

scalafx-hello-world and scalafx-ensemble were updated to illustrate use with Scala 3. "hello-world" shows use of Scala 3 syntax with no curly braces, see branch Scala3. The "ensemble" is written in way compatible with both with Scala 2.13 and Scala 3.0.


Bene Volent

unread,
Apr 23, 2021, 8:31:53 AM4/23/21
to scalaf...@googlegroups.com
It is stated that "ensemble" is written to be compatible with version 2.13 and 3.0 of Scala.

QUESTION: Is there a possibility to summarize key points to consider to make a ScalaFX deployment compatible for 2.13 and 3.0 and highlight the 2.13 ->3.0 transition issues/gotcha's  in case of ScalaFX?

On Fri, Apr 23, 2021 at 3:14 AM Jarek <jps...@gmail.com> wrote:
The two main features of this release is support for Scala 3 (RC3) and JavaFX 16. More details are in the Release Notes.

scalafx-hello-world and scalafx-ensemble were updated to illustrate use with Scala 3. "hello-world" shows use of Scala 3 syntax with no curly braces, see branch Scala3. The "ensemble" is written in way compatible with both with Scala 2.13 and Scala 3.0.


--
You received this message because you are subscribed to the Google Groups "ScalaFX Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalafx-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalafx-users/f70d10eb-40ca-45ac-833e-04b46ac0fe93n%40googlegroups.com.

Jarek Sacha

unread,
Apr 23, 2021, 1:49:31 PM4/23/21
to scalaf...@googlegroups.com

On Fri, Apr 23, 2021 at 8:31 AM Bene Volent invic...@gmail.com wrote:

It is stated that "ensemble" is written to be compatible with version 2.13 and 3.0 of Scala.

QUESTION: Is there a possibility to summarize key points to consider to make a ScalaFX deployment compatible for 2.13 and 3.0 and highlight the 2.13 ->3.0 transition issues/gotcha's  in case of ScalaFX?

Good part is that Scala 3 largely accepts code that compiles in Scala 2.13. It really depends how your code is written. Frequently it may not require any changes. There is an extensive Scala 3 Migration Guide. Note that the current ScalaFX code base , similar to the Ensemble, compiles with both in Scala 2 and 3 (there is no code that is only Scala 3, at least not yet).

From my own experience, based on working on ScalaFX-Ensemble, it was not too difficult. Most code worked without corrections. Things to keep in mind in the context of ScalaFX:

  • Use Scala 3 compiler options “-explain” and “-explain-types” they will give you more information about the error and give hints how to correct. Compared to Scala 2, new error messages are much more useful,
  • Correct any deprecation warnings that you may have in 2.13 code
  • If you use JFXApp, replace with JFXApp3 (since DelayedInit no longer works in Scala 3)
  • May need to add import scala.language.implicitConversions to enable implicits
  • Variable scopes are tweaked in Scala 3, so you may need to add a scope prefix (say this.title instead of just title) or rename. Not common, but happens. Scala 3 compiler error will tell you when this happens.

One thing that is a headache in my own projects. I use ScalaFXML a lot. Since annotation macros were removed from Scala 3 (at least for now). ScalaFXML currently does not work with Scala 3. You will need to rewrite your “controllers” without ScalaFXML or see when Scala 3 is supported.

Making ScalaFX code base work with Scala 3 was more challenging. In the process I did find some Scala 3 bugs (https://github.com/lampepfl/dotty/issues/12091) and “glitches” with unclear causes. For instance, construct when/choose/otherwise like in fill <== when(hover) choose Green otherwise Red requires some workarounds to compile in Scala 3. Not clear to me why, hopefully this will be addressed in future versions (help with figuring it out really welcomed). If you get across your own code, using ScalaFX, that compiles in Scala 2.13 but not in Scala 3, please report. That will help to improve ScalaFX.

Jarek

Daniel Vigovszky

unread,
Apr 26, 2021, 2:18:10 PM4/26/21
to ScalaFX Users
Hi all,

I started working on a Scala 3 version of ScalaFXML. With the lack of macro annotations the best I can do is a code generator sbt plugin, but it will provide a very similar set of features and I hope it will make migration relatively painless. I will try to spend some time on it this week and release an RC.

vigoo
Reply all
Reply to author
Forward
0 new messages