Skip to content
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

Switch to new scheme for translating context bounds #15549

Closed
wants to merge 2 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 29, 2022

This is a trial balloon to find out what would break if we change the desugaring of context bounds to the one currently supported under -source future. Context bounds now translate to using clauses instead of implicit parameters.

@odersky
Copy link
Contributor Author

odersky commented Jun 29, 2022

Conclusion: lots of things break, currently, if we try to do that. We'll need a deprecation phase first, where we warn when an implicit parameter stemming from a context bound is instantiated with an explicitly passed, plain (non-using) argument.

The question is, from which version should we deprecate? The problem is is there's no good way to avoid the deprecation in code that still should compile under Scala 2, since Scala 2 has no equivalent for a using argument clause.

So, what is more important for a Scala 3 LTS? Being able to cross-compile with Scala 2 without deprecation warnings, or getting deprecation warnings early to know what code should be changed in Scala 3?

@odersky odersky closed this Jun 29, 2022
@smarter
Copy link
Member

smarter commented Jun 29, 2022

We could update the Scala 2 compiler to accept but ignore the using keyword (ideally by default but possibly under -Xsource:3), just like I previously tweaked it to accept but ignore case in pattern bindings (scala/scala#9721) and open/infix (scala/scala#9580).

@odersky
Copy link
Contributor Author

odersky commented Jun 29, 2022

I think that would be the best course of action. I'll open an issue.

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

Successfully merging this pull request may close these issues.

None yet

2 participants