Skip to content
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

Use looser callable type in place of Closure #378

Closed
tyteen4a03 opened this issue Jul 31, 2023 · 4 comments
Closed

Use looser callable type in place of Closure #378

tyteen4a03 opened this issue Jul 31, 2023 · 4 comments

Comments

@tyteen4a03
Copy link

Would it be possible for Collection methods to typehint for callable instead of Closure so I can pass non-anonymous functions to the methods?

@greg0ire
Copy link
Member

Have you considered using Closure::fromCallable()?

@tyteen4a03
Copy link
Author

Yes that's possible, but why not use a looser and 100% compatible type? AFAICT the code does not use characteristics only available to Closures.

@greg0ire
Copy link
Member

greg0ire commented Jul 31, 2023

Duplicate of #231

(and also, with first-class callable syntax, which creates closures, this is even simpler now than what I previously suggested)

@greg0ire greg0ire marked this as a duplicate of #231 Jul 31, 2023
@greg0ire greg0ire closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
@derrabus
Copy link
Member

I've laid out my reasons for requiring closures here: #321 (comment)

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

No branches or pull requests

3 participants