Imagine you have something like this: * func foo(data []int, suitable func(v int) bool) []int { * * result := make([]int, 0, len(data) * * for _, v := range data { * * if suitable(v) { * * result = append(result, v) * * } * * } return result * *} *
func main() { data := []int{1, 2, 3, 4, 5} foo(data, func(v int) bool { return v % 2 == 0 }) } If instead of suitable lambda I use an explicit function call, that call may be inlined in Go. But C++ supporting inlining for copied closures. Does golang support inlining for lambdas, if I have that function signature? Or only non-escaping to the other functions lambdas can be inlined? I found this issue which is still open -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/059c6b10-dc81-4f17-bc56-1db59f2a1fbcn%40googlegroups.com.