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

proposal: Go 2: functional interface like implementation #59095

Closed
mstrYoda opened this issue Mar 17, 2023 · 2 comments
Closed

proposal: Go 2: functional interface like implementation #59095

mstrYoda opened this issue Mar 17, 2023 · 2 comments

Comments

@mstrYoda
Copy link

Currently Go has first class functions and duck type interfaces.

It would be handy to have functional interfaces for easily passing a function as a parameter to another function that expects an interface with has only one function definition.

Example:

type Some interface {
  SomeFunc(param int) int
}

func Test(s Some) {
...
}

f := func(a int) int {
...
}

Test(f)

WDYT about it?

@gopherbot gopherbot added this to the Proposal milestone Mar 17, 2023
@fzipp
Copy link
Contributor

fzipp commented Mar 17, 2023

This is a duplicate of #21670

@mstrYoda
Copy link
Author

This is a duplicate of #21670

Thank you, closed.

@golang golang locked and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants