Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add method applyToContext to all FunctionN traits #10923

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: 2.13.x
Choose a base branch
from

Conversation

sideeffffect
Copy link
Contributor

applyToContext essentially turns ordinary functions to "contaxtual" functions.
This is an indispensable piece of functionality when working with contextual functions and contexts, which is the hallmark of Scala. Thus applyToContext belongs to the standard library.

Alternative names

  • toContextual
  • fromContext
  • ...?

@scala-jenkins scala-jenkins added this to the 2.13.16 milestone Nov 11, 2024
@sideeffffect sideeffffect reopened this Nov 11, 2024
@sideeffffect
Copy link
Contributor Author

Hello @SethTisue , could you please point me in the right direction how a PR like this can get merged?

@lrytz lrytz modified the milestones: 2.13.16, 2.13.17 Nov 18, 2024
@lrytz
Copy link
Member

lrytz commented Nov 18, 2024

@sideeffffect we're planning to open up the standard library for new additions in 2.13.17 (https://docs.scala-lang.org/sips/drop-stdlib-forwards-bin-compat.html), we'll look into this PR for that release. 2.13.16 will stick to the old forwards binary compatibility, it's going to be a small release to support 3.6.

@sideeffffect
Copy link
Contributor Author

Given that both 2.13.16 and 3.6.0 have been released, can this PR get reviewed, please? @lrytz

@sjrd
Copy link
Member

sjrd commented Mar 25, 2025

IMO this is lacking a serious motivation. Is there for example a Contributors thread where several users express the need for these methods? Anecdotally, you need them; also anecdotally, I never came across that need. ;)

Also, for the PR as such, should it move forward, it needs tests.

@sideeffffect
Copy link
Contributor Author

I've described a use case for this here https://old.reddit.com/r/scala/comments/1eqqng2/the_simplest_dependency_injection_pure_scala_no/

In short, I believe converting between ordinary and contextual function is important and will be even more, once ?=> in Scala 3 becomes even more popular.

But I'd be happy to open a new thread on Contributors, soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants