sbt-typelevel icon indicating copy to clipboard operation
sbt-typelevel copied to clipboard

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

Open armanbilge opened this issue 2 years ago • 4 comments

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?

armanbilge avatar Jun 23 '23 13:06 armanbilge

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.

ChristopherDavenport avatar Jun 23 '23 13:06 ChristopherDavenport

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.

djspiewak avatar Jun 23 '23 14:06 djspiewak

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?

rossabaker avatar Jun 23 '23 14:06 rossabaker

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

armanbilge avatar Jun 23 '23 14:06 armanbilge