3 ms·
If you have closures, you can simulate objects. In many different ways, most of them bad. If you have an interpreter with decent variable semantics, you get clo
by Animats 10y ago
If you have closures, you can simulate objects. In many different ways, most of them bad. If you have an interpreter with decent variable semantics, you get closures. That's how LISP did objects in the 1980s, before people knew better. Javascript somehow got it from there.
Why do we have to keep reviving the bad ideas?
- kazinator 10y agoLisp had CLOS in the 1980's, and before that, precursors to CLOS.
- lispm 10y ago> you get closures. That's how LISP did objects in the 1980s, before people knew better That one can use closures for objects was demonstrated with Scheme in the 70s. See for example: Scheme: An Interpreter for Extended Lambda Calculus". MIT AI Lab. AI Lab Memo AIM-349. December 1975. http://library.readscheme.org/page1.html http://library.readscheme.org/page1.html It's also a typical topic in education to show how to use closures to implement a primitive object system, similar how one learns to 'implement' numbers in pure lambda calculus. But actual object systems in Lisp from the 70s/80s mostly did not use closures as objects. None of LOOPS, Flavors, CLOS, KRL, KEE, FRL, ... uses closures for their implementation. Even in 'Object Lisp', which is relatively close to Javascript's objects, they don't use closures: http://www.unlambda.com/lispm/lmi-source/extract/dj_full/l/objectlisp/ http://www.unlambda.com/lispm/lmi-source/extract/dj_full/l/o... In http://www.unlambda.com/lispm/lmi-source/extract/dj_full/l/objectlisp/obj.lisp.155 http://www.unlambda.com/lispm/lmi-source/extract/dj_full/l/o... you can see that objects in Object Lisp were implemented by using structures (aka records), not closures.