typelevel / sbt-typelevel

Let sbt work for you.
https://typelevel.org/sbt-typelevel/
Apache License 2.0
170 stars 47 forks source link

RFC: use `_` instead of `*` for kind-projector #560

Open armanbilge opened 1 year ago

armanbilge commented 1 year ago

Scala 3 uses _ for kind projector and ? for existential wildcards, but supports the old */_ for compatibility with Scala 2.

I just discovered that Scala 2.12 and 2.13 can also be configured to use the new syntax. https://github.com/typelevel/kind-projector#inline-underscore-syntax

One of the goals of sbt-typelevel v0.5.0 is to configure scalac so that it behaves more like "true" Scala 3. So I feel very tempted to make this change. We're already using the new syntax in Scala 3-only builds which has been a source of confusion when removing Scala 2 from the cross versions.

However this is a somewhat drastic change already into the RC cycle and will require a lot of existing code to be rewritten, I'm not sure how well find-replace could work.

Thoughts?

ChristopherDavenport commented 1 year ago

This would be a very large source breaking change to anyone using this. As someone with a lot of code that has the new components in place this concerns me, as it means a lot of manual rewrites throughout the entire corpus to then update this plugin.

Its not unreasonable, but its also going to force all of your users to pay a tax, and it may be a lot.

djspiewak commented 1 year ago

I feel like it's better to do this in a couple of stages. Start by adding it default-off behind a setting, then in the next release add a warning if it's off, then the release after that swap the default to on, then after that add @deprecated to the setting.

rossabaker commented 1 year ago

Can I pay my taxes with a Scalafix, or just hard labor? Do editors widely support this non-default syntax for what's already a foreign compiler plugin?

armanbilge commented 1 year ago

Thanks everyone. Daniel is right, this should definitely be a toggleable setting, starting with opt-in. We can revisit in the future.