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.
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:
JFXApp
, replace with JFXApp3
(since DelayedInit no longer works in Scala 3)import scala.language.implicitConversions
to enable implicitsthis.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