-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add capture-checking annotations to scala.util.boundary
#22775
base: main
Are you sure you want to change the base?
Conversation
b078f30
to
72f2687
Compare
72f2687
to
28c21ee
Compare
Shouldn't cc changes in the library go to https://github.com/scala/scala3/tree/main/scala2-library-cc/src/scala and not the actual library ? |
|
@sjrd what's your opinion on the breaking changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change or not, I don't think we have consensus about taking the risk of introducing CC annotations in the standard standard library.
So far, it has always been pretty clear that CC goes to an alternate library that people can depend on if they want to. Here this is a much bigger "attack surface".
At the very least this requires a Core discussion.
Right, I'm overlooked that. Nevertheless, I agree with @sjrd, we don't have a consensus about adding cc-related code in the stdlib. |
Adds capture-tracking annotations to
scala.util.boundary
.The following changes are made:
Label[T]
is now a capability, directly inheritingcaps.Capability
.Break
exception:.label
field. This is a source-breaking change. - however,label
is stillprivate[boundary]
, which should make it TASTy- and binary-compatible.Break
exception, if some code is manually implementingboundary.apply
's logic, we instead provide aisSameLabelAs
method, that compares the givenLabel[T]
with the innerLabel
without leaking it.Break
exceptions may still possibly cause them to escape theboundary
.To demonstrate that capture-checking works, a test is included.