"methods and func's are closures. no difference, just different syntax": is this correct?

I said this on twitter to John Sundell, who I learn a whole lot from.

I said that because I thought that's what the language reference say about closure:

Global and nested functions, as introduced in Functions, are actually special cases of closures. Closures take one of three forms:

  • Global functions are closures that have a name and don’t capture any values.
  • Nested functions are closures that have a name and can capture values from their enclosing function.
  • Closure expressions are unnamed closures written in a lightweight syntax that can capture values from their surrounding context.

I'm confused because he said:

... you can pass any method as if it was a closure, but that doesn't make all methods closures. Think of it this way: you can convert any method into a closure, just like how you can convert any Substring into a String. Doesn't make them the same, just interoperable.

I don't know what to make of this: if you can pass any method as closure, then methods are closure.

Anyway, I need final judgement on this so I can unconfused myself.

1 Like