- Notifications
You must be signed in to change notification settings - Fork1.1k
chore: deprecatescala.util.ChainingOps#24725
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| @nowarn("msg=ChainingSyntax will be removed in the future") | ||
| objectchainingextendsChainingSyntax: | ||
| extension[A](x:A) | ||
| inlinedeftap(inlinef:A=>Unit): x.type= { f(x); x } |
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.
The signature here differs from the one we used to have inscala.util.ChainingOps. First, we return a more precise type:x.type. Second, we do not need to have a second type variable and specify thatf: A => B since we adapt the body of the lambda after the eta-expansion. This code will compile because of the adaptation for example:
deffoo(x:String):String="()"valx:String=>Unit= foodefbar(f:String=>Unit)= ()bar(foo)bar(x)
| f(self) | ||
| self | ||
| } | ||
| deftap[U](f:A=>U):A= scala.util.chaining.tap(self)(x=> f(x)) |
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.
| deftap[U](f:A=>U):A= scala.util.chaining.tap(self)(x=> f(x)) | |
| deftap[U](f:A=>U):A= scala.util.chaining.tap(self)(f) |
But it is blocked by#24726
| */ | ||
| objectchainingextendsChainingSyntax | ||
| @nowarn("msg=ChainingSyntax will be removed in the future") | ||
| objectchainingextendsChainingSyntax: |
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.
Question for me: Can we move this object to be outside thepackage object util?
sjrd commentedDec 11, 2025
This PR's communication is off. Thevalue added by the first commit is that Even more so, the second commitadds a public method to the API. There is no world in which this should be categorized as "chore". This is the archetypical "feat" according to any such categorization. |
| @nowarn("msg=ChainingSyntax will be removed in the future") | ||
| objectchainingextendsChainingSyntax: | ||
| extension[A](x:A) | ||
| inlinedeftap(inlinef:A=>Unit): x.type= { f(x); x } |
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.
if you don't want to break imports likeimport scala.util.chaining.given then you can put these in agiven AnyRef:
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.
For sake of completeness, as I told you in private. I don't want to do weird things just to satisfy source compatibility. This is the cleanest way to have this improvement.
hamzaremmal commentedDec 12, 2025
This PR was never meant to be reviewed yet. It is still a draft PR. |
No description provided.