Skip to content

-Xsource:... should be documented as not for use in production/publishing #11661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SethTisue opened this issue Aug 5, 2019 · 7 comments · Fixed by scala/scala#8813
Closed
Assignees
Milestone

Comments

@SethTisue
Copy link
Member

SethTisue commented Aug 5, 2019

I have seen it come up many many times on Gitter and elsewhere, that people thought -Xfuture (which doesn't exist anymore) or -Xsource:... was something it was just fine to sprinkle on their scalacOptions without thinking too much about it

for example, -Xfuture is included in https://tpolecat.github.io/2017/04/25/scalac-flags.html , which is widely referred to (/cc @tpolecat)

over at https://docs.scala-lang.org/overviews/compiler-options/index.html the entry for -Xsource just says:

Treat compiler input as Scala source for the specified version, see #8126

I suggest that -Xsource:... be documented as something that should only be used for experimenting and to get migration information, you shouldn't enable it when building something you're going to deploy or publish

why? because these flags enable poorly-tested combinations of possibly half-baked stuff, the version of the compiler you get when you enable this hasn't been QA'ed anywhere near as heavily as the default one has

and since we have published the reference to #8126, I would also suggest that the description on that ticket be improved so that anyone consulting it will see the same warning text

@eed3si9n
Copy link
Member

eed3si9n commented Aug 5, 2019

I actually think more people would be happier if they used -Xlint, -deprecation, and -Xfatal-warnings (on whatever the main Scala version you work with the most), similar to what Rob suggests, and I'd include -Xsource:2.14.

If testedness of -Xsource:2.14 is somehow the problem (do you have specific behavior in mind like #11657 and #11644?), then we should fix that instead.

@SethTisue
Copy link
Member Author

SethTisue commented Aug 5, 2019

I don't have specific behavior in mind. It's just we don't run the Scala test suite with -Xsource:2.14 enabled, and we don't run the community build that way either, and (re "we should fix that"), doing that seems like an impractical expansion in scope to me.

@eed3si9n
Copy link
Member

eed3si9n commented Aug 5, 2019

To expand on my "then we should fix that instead" position, I think we should be fairly conservative on what we include into -Xsource:2.14. For example, in scala/scala#6325 I deprecated the procedure syntax and dropped it completely in -Xsource:2.14. If you can bring your code base up to that, there's no reason not to recommend that behavior for use in production/publishing. This is an example that also highlights the integration testing to be difficult because it would require large-but-clean code base with zero procedure syntax.

@SethTisue SethTisue removed the blocker label Aug 27, 2019
@SethTisue SethTisue modified the milestones: 2.13.1, 2.13.2 Sep 9, 2019
neko-kai added a commit to 7mind/sbtgen that referenced this issue Nov 4, 2019
neko-kai added a commit to 7mind/sbtgen that referenced this issue Nov 4, 2019
* renames for Project fields

* Disable eta-sam lint scala/bug#11644

* Enable compiler plugin & macro classloader caching for faster builds (however, this supposedly breaks macros with global mutable state...)

scala/scala#6412
https://twitter.com/olafurpg/status/1191299377064824832
> The caching logic for compiler plugins is enabled by default in Bloop and that one does make a difference,
  around 20/30%, see scala/scala-dev#458

* Don't use -Xsource: since it's not recommended scala/bug#11661

* fix Ybackend-parallelism option

* empty `enabled` default parameter for  Plugins
@SethTisue SethTisue self-assigned this Feb 6, 2020
@SethTisue SethTisue modified the milestones: 2.13.2, 2.13.3 Feb 6, 2020
@som-snytt
Copy link

A heavy hand in the linked PR.

@SethTisue
Copy link
Member Author

SethTisue commented Feb 17, 2023

Just a note that over the course of the last 3.5 years, things have changed and -Xsource:3 has gone on to acquire a rather more, shall we say, "mainstream" status than it had in 2019.

@som-snytt
Copy link

It would be nice to get the project on -Xsource:3, early defs being the hang-up. The implicit search change that is now -Yscala3-implicit-resolution is the biggest "fail" in making it a no-brainer otherwise, just because predictability is paramount. The other factor is that the source option cannot be taken piecemeal, but all or nothing.

It's so much nicer to write import mutable.*. There's a short list of "things that make -Xsource:3 worth it." "Leading infix" is another, but probably under-exercised for bugs, especially since it fell behind dotty changes.

@SethTisue
Copy link
Member Author

It would be nice to get the project on -Xsource:3,

Oh, actually bootstrap using it? That's an idea that hadn't occurred to me before...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants