-
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 @scala.annotation.internal.preview
annotation and -preview
flag.
#22317
base: main
Are you sure you want to change the base?
Conversation
So what happens when a library uses a preview feature and publishes? A user can depend on it without turning on preview? |
Yes, user can depend on it without turning on preview as long as the exposed API does not use any preview features. Preview features can become an implementation detail that is not exposed to referrer of definition. |
@scala.annotation.preview
annotation and -preview
flag.@scala.annotation.internal.preview
annotation and -preview
flag.
c2bf79d
to
fd67fc1
Compare
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.
Except for suggestions, LGTM.
This adds
@scala.annotation.internal.preview
to mark Scala 3 stdlib API as preview-only and accessors for easy marking Scala features in the compiler as preview (similarly to experimental features)Access to preview features/API is granted to user using the
-preview
compiler flag - it enables all access to preview features/API without possibility to enable only their subset.@preview
annotated definitions follows the same rules as@experimental
with exception of being non viral - we're not automatically adding@preview
annotation to when refering to preview definitions, but still require preview scope (by-preview
flag), we still check if class overloads, overrides or externs a definition marked as@preview
.Other difference is that
@preview
isprivate[scala]
to prevent users from defining their own preview definitions as it was happening with@experimental