Comment by zzzcpan
10 years ago
> which you've created as closures, but note you're still returning a struct
a struct of three closures :)
EDIT:
I'm not sure I understand your point. Here's how to return three closures without the struct.
10 years ago
> which you've created as closures, but note you're still returning a struct
a struct of three closures :)
EDIT:
I'm not sure I understand your point. Here's how to return three closures without the struct.
Yes, I said that. Please try less hard for the "gotchas". There's no ambiguity here, the Go type system does not permit it; something is either a struct or a closure (or exactly one of the other valid types; even "interfaces" are actually a specific type in Go), and the linked code returns a struct. (Python, for instance, can create something that acts as both object and closure at the same time with an object that implements the __call__ magic method.)