scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.84k stars 1.05k forks source link

Deprecate XML literals #19100

Open SethTisue opened 10 months ago

SethTisue commented 10 months ago

@nicolasstucki seems like probably an oversight that there isn't already a ticket on this? (that I can find)

not sure what the right timetable is. at present, it doesn't even warn under -source:future

% scala-cli -S 3.nightly -source:future --dep org.scala-lang.modules::scala-xml:2.2.0
Welcome to Scala 3.4.0-RC1-bin-20231127-41e7d95-NIGHTLY-git-41e7d95 (17.0.9, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> <foo/>
val res0: scala.xml.Elem = <foo/>

at minimum, I think it should warn under -source:future, as the SIP committee has already authorized the eventual removal of XML literals from the language, and the Scala 3 reference doc already lists it under "Dropped Features" (https://docs.scala-lang.org/scala3/reference/dropped-features/xml.html)

whether it's time to actually deprecate, I don't have a strong opinion about. I don't know how polished or usable https://github.com/lampepfl/xml-interpolator is. the availability of a suitable substitute has always been the major concern here, iirc

SethTisue commented 10 months ago

Also, I think the XML chapter of the Scala 3 spec could be deleted. I don't think we need to wait for the feature to actually be deleted from the compiler. It's already legacy, and it will remain available in the Scala 2 spec for reference. cc @sjrd

SethTisue commented 8 months ago

with https://github.com/lampepfl/dotty/pull/19101 merged, the default behavior remains not-even-a-warning, but the -source:future behavior is a hard error:

1 |<foo/>
  | ^^^^^
  |XML literals are no longer supported.
  |See https://docs.scala-lang.org/scala3/reference/dropped-features/xml.html
nicolasstucki commented 8 months ago

This behavior was intentional. We decided to deprecate it later. See https://github.com/orgs/lampepfl/projects/2/views/11