-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make into
a preview feature
#24090
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
Make into
a preview feature
#24090
Conversation
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.
Shouldn't it now use @scala.annotation.internal.preview
annotation instead of making it stable?
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.
This is not really needed. It is an internal annotation that people will not use manually.
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.
Well, even then. In theory it's part of a preview feature, and could be altered. (Very very unlikely in this case, but let's follow the procedure, so that the next person who comes to this PR in search for a reference of how a feature becomes preview doesn't get misled.)
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.
I agree, if we were to be pedantic, we should put it. I just claimed that from an implementation point of view, it is not really needed.
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.
Not sure about this one, and how it should be handled. From the perspective of user it would be better to now get hint about preview, and standard
when it's actually standardised in 3.9 or later
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.
perhaps hint about preview since 3.8...
and standard whenever we stabilise
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.
We should not say since 3.9.0
in 3.8.0
. It makes no sense. I think we should say (preview, 3.8.0) and change it to (stable, 3.9.0) later or say directly (stable, 3.8.0).
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.
This is not really needed. It is an internal annotation that people will not use manually.
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.
library/src/scala/language.scala
Outdated
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.
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.
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.
This one is important, if we don't mark this alias with @preview
, we will not be able to enforce it.
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.
This one should also be marked as @preview
, otherwise we will be compiling the library with -preview
- Make all aspects of into a -preview feature - Drop experimental import in tests
Since SIP 71 is now accepted, we can ship it as -preview in 3.8 and standard in 3.9.
Note to tooling implementers
There are two relevant pieces that need to be implemented in IDEs:
into
is a new soft modifier for classes, traits, and enums. Types withinto
are legal conversion target types. SeeisConversionTargetType
inTypes.scala
.Conversion.into
type is a regular opaque type, so should not need any support by itself. However, there's a rule that no-flip covariant occurrences ofinto[T]
in method parameters are mapped toT @$into
, where$into
is an annotation inannotation.internal
. The annotation is "silent" which means it should not be shown in inferred types. The purpose of that mapping is thatinto[...]
does not have to be explicitly stripped in method bodies. SeesuppressInto
andrevealInto
in TypeOps./cc @unkarjedy @tgodzik