Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
hamzaremmal wants to merge2 commits intoscala:main
base:main
Choose a base branch
Loading
fromhamzaremmal:chaining

Conversation

@hamzaremmal
Copy link
Member

No description provided.

@nowarn("msg=ChainingSyntax will be removed in the future")
objectchainingextendsChainingSyntax:
extension[A](x:A)
inlinedeftap(inlinef:A=>Unit): x.type= { f(x); x }
Copy link
MemberAuthor

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))
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Suggested change
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

@hamzaremmalhamzaremmal added this to the3.10.0 milestoneDec 11, 2025
@hamzaremmalhamzaremmal added area:libraryStandard library needs-minor-releaseThis PR cannot be merged until the next minor release labelsDec 11, 2025
*/
objectchainingextendsChainingSyntax
@nowarn("msg=ChainingSyntax will be removed in the future")
objectchainingextendsChainingSyntax:
Copy link
MemberAuthor

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
Copy link
Member

This PR's communication is off.

Thevalue added by the first commit is thattap andpipe become moreinline, guaranteeing that they have no overhead. That's what the commit message should say. The deprecation is secondary and should appear in the body of the commit message. Also that's definitely not a "chore" since it provides value to end users.

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 }
Copy link
Member

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:

Copy link
MemberAuthor

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
Copy link
MemberAuthor

This PR was never meant to be reviewed yet. It is still a draft PR.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@bishaboshabishaboshabishabosha left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

area:libraryStandard libraryneeds-minor-releaseThis PR cannot be merged until the next minor release

Projects

None yet

Milestone

3.10.0

Development

Successfully merging this pull request may close these issues.

3 participants

@hamzaremmal@sjrd@bishabosha

[8]ページ先頭

©2009-2025 Movatter.jp