[ 
https://issues.apache.org/jira/browse/DAFFODIL-2975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17931541#comment-17931541
 ] 

Mike Beckerle commented on DAFFODIL-2975:
-----------------------------------------

I've ceased work on this. It looks to be quite hard to move to Scala 3. Even 
using the 2.13 migration mode. 

This comment is not to make it seem impossible, just to make it clear that it 
doesn't "just work" since the Scala 3 compiler supports scala 2.13 "mostly". 
Turns out the things it doesn't support... we use those all the time.

There are the XML Problems - embedded XML syntax is going away, though still 
supported for constructing XML, pattern matching is not supported, and the 
longer term story ... it seems embedded XML literals will *eventually* cease to 
be supported at all in favor of string interpolators - though there is no 
official XML string interpolator library, and there is no pattern match support 
in any case. There is no truly compact work-around other than translating into 
nested case-class objects like Elem(_, _, _, _, child) and such.

We should consider whether this is the right opportunity to move all the XML 
Schema direct hacking out out of being ad-hoc distributed all over the code 
base, and create a centralized way to deal with XSD parsing. People want a 
non-XSD way to write XML Schemas after all., both by parsing an alternate 
syntax, and just using an API to construct a schema. 

There are many, many code incompatibilities where Scala 3 seems to deem code 
that was acceptable before is illegal now - I fail to understand some of these. 
There are places where protected methods in traits that are clearly inherited, 
are not available. Quite a lot of protected to public changes are required. 

I ran into one very tiny piece of code that was crashing the Scala 3 compiler 
(lots of error messages call it the "dotty" compiler.) Aparently inheriting 
from Java Exception  is a problem. I was unable to use a private lazy val in 
the class ThinException (in daffodil-lib), and had to rewrite with a var and an 
init routine to assign it. 

In trying to compile, there's been only one thing, in the hundreds of errors, 
that their tool said they could rewrite automatically. And I haven't gotten 
past Daffodil-lib yet. 

There are tooling issues: genjavadoc no longer works and they say the scaladoc 
system now supports generating java javadoc. 

 

> Add support for Scala 3
> -----------------------
>
>                 Key: DAFFODIL-2975
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2975
>             Project: Daffodil
>          Issue Type: New Feature
>          Components: Infrastructure
>    Affects Versions: 4.0.0, 3.10.0
>            Reporter: Mike Beckerle
>            Priority: Major
>
> Now that we have scala 2.13 support.... 
> We should be able to support scala 3 since the scala 3 compiler has a 
> migration model for scala 2.13 code.  (-source:3.0-migration). They claim it 
> supports a -rewrite option also, but I would be hesitant to use that without 
> much experimentation to see what it actually does. 
> Note: I believe we should *never* switch to the indent-oriented scala 3 
> syntax. We should require the code base to retain the curly brace syntax.  
> The scala 3 compiler has an option to enforce this (-no-indent)
> A lot of our code is not at all amenable to this indent-oriented stuff, and 
> never will be. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to