Comment by kd0amg

10 years ago

A closure is a data structure commonly used to represent a first-class function (containing a function pointer for the code and some sort of structure mapping the environment's bound variables to their values). Implementing a language with first-class functions does not require using closures. You could have an interpreter that performs beta reduction on the syntax tree, and first-class functions would still behave the same way. So closures are an implementation detail.

In OOP, there are pieces of data that have operations associated with them. Two objects are free to have their own "version" of the same operation (same-named), and when you invoke it on an object, you get that object's version. In writing one of those operations, you have a handle on the thing you're operating on without having to take it as an argument. This specifies what result you'll compute and what side effects you'll cause by invoking an operation (i.e., the semantics). It does not specify things like where in program memory the code for that operation will live or how invoking it will work (implementation).