← Back to context

Comment by detrino

10 years ago

A closure is 1 function and an environment. An object is N functions and an environment.

Objects are more useful as you don't need to repeat the environment to implement more than 1 operation.

Both objects and closures can be type erased so that the environment is not part of their type.

That single closure function could return e.g. a map containing more functions that share the same environment.