Consider a method m of a class A in an object-oriented language like Java or C++.
In the body of the method m it is possible to reference the member variables of the object on which the method is invoked. These variables are not defined in the method itself but are bound in the moment in which the method is invoked.
Is this the same mechanism used for closures (binding non-local names using the context) or, if not, what are the differences?
In other words, would it be possible to view an object with its methods as a collection of closures (the methods) that are closed over some common data (the object's member variables)?
self
parameter). That doesn't mean it's a closure though.