Skip to content

Make caps.Capability non-experimental #23507

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2112,8 +2112,8 @@ class Definitions {
*/
@tu lazy val ccExperimental: Set[Symbol] = Set(
CapsModule, CapsModule.moduleClass, PureClass,
Caps_Capability, // TODO: Remove when Capability is stabilized
Caps_Classifier, Caps_SharedCapability, Caps_Control, Caps_ExclusiveCapability, Caps_Mutable, Caps_Read,
/* Caps_Classifier, Caps_SharedCapability, Caps_Control, -- already stable */
Caps_ExclusiveCapability, Caps_Mutable, Caps_Read,
RequiresCapabilityAnnot,
captureRoot, Caps_CapSet, Caps_ContainsTrait, Caps_ContainsModule, Caps_ContainsModule.moduleClass,
ConsumeAnnot, UseAnnot, ReserveAnnot,
Expand Down
4 changes: 0 additions & 4 deletions library/src/scala/caps/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ import annotation.{experimental, compileTimeOnly, retainsCap}
*
* Capability has exactly two subtraits: Shared and Exclusive.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's at least make the scaladocs with @experimental or mention it, so that people are aware that there is still a scenario that this might be deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgodzik I think we are ready to commit to that now. That is, if capture checking becomes standard at one time then we plan to have these traits defined. The doc page is waiting to be merged here: https://github.com/scala/scala3/blob/3658d3da98eb0c5ed33c74ec6402562330bf9ed8/docs/_docs/reference/experimental/capture-checking/classifiers.md

If capture checking does not make it into the standard, the whole caps package would be deprecated and dropped. So in a sense it does not matter which traits are exposed in there.

An alternative would be to bend the rules so that we make boundary.Label non-experimental even though it would extend experimental traits, which is usually not allowed. I am not sure that would address the concerns with inlining though. @natsukagami can you comment on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine I think. I was mostly hoping to mention in some place that this is not something people should use unless they are experimenting with CC

*/
@experimental
sealed trait Capability extends Any

/** A marker trait for classifier capabilities that can appear in `.only`
* qualifiers. Capability classes directly extending `Classifier` are treated
* as classifier capbilities
*/
@experimental
trait Classifier

/** The universal capture reference. */
Expand All @@ -41,7 +39,6 @@ object cap extends Capability
/** Marker trait for capabilities that can be safely shared in a concurrent context.
* During separation checking, shared capabilities are not taken into account.
*/
@experimental
trait SharedCapability extends Capability, Classifier

@experimental
Expand All @@ -58,7 +55,6 @@ type Exclusive = ExclusiveCapability
/** Base trait for capabilities that capture some continuation or return point in
* the stack. Examples are exceptions, labels, Async, CanThrow.
*/
@experimental
trait Control extends SharedCapability, Classifier

/** Marker trait for classes with methods that require an exclusive reference. */
Expand Down
4 changes: 4 additions & 0 deletions project/MiMaFilters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ object MiMaFilters {
ProblemFilters.exclude[MissingClassProblem]("scala.annotation.internal.onlyCapability"),
ProblemFilters.exclude[MissingFieldProblem]("scala.runtime.stdLibPatches.language#experimental.separationChecking"),
ProblemFilters.exclude[MissingClassProblem]("scala.runtime.stdLibPatches.language$experimental$separationChecking$"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps.Capability"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps.Classifier"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps.SharedCapability"),
ProblemFilters.exclude[MissingClassProblem]("scala.caps.Control"),
),

// Additions since last LTS
Expand Down
4 changes: 0 additions & 4 deletions tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ val experimentalDefinitionInLibrary = Set(
"scala.annotation.retainsCap",
"scala.Pure",
"scala.caps.CapSet",
"scala.caps.Capability",
"scala.caps.Classifier",
"scala.caps.Contains",
"scala.caps.Contains$",
"scala.caps.Contains$.containsImpl",
"scala.caps.Exists",
"scala.caps.SharedCapability",
"scala.caps.ExclusiveCapability",
"scala.caps.Mutable",
"scala.caps.Read",
"scala.caps.Control",
"scala.caps.consume",
"scala.caps.internal",
"scala.caps.internal$",
Expand Down
Loading