4 ms·
What did he mean when mentioning McCarthy having solved that "change of state" problem?
by swah 10y ago
What did he mean when mentioning McCarthy having solved that "change of state" problem?
- jstimpfle 10y agoDon't know his or your context, but McCarthy is the creator of Lisp, so in a way he's one of the pioneers of functional programming (there were of course other mathematicians inventing the foundations). Which is a way to combine programs from small building blocks that are just functions knowing no global state - they always return the same answer given the same arguments. Contrast this to procedural or object oriented programming where usually the parts know a lot more about the context (state) than they really need to know. This can lead to implicit (and hard to discover) assumptions about the state of the world that are broken later on when some parts are changed, leading to bugs. The way this works is by combining functions with (higher order) functions. For example, chain a function that gets A and returns B with a function that gets B and returns C. This is done without ever speaking of concrete inputs - reducing unnecessary knowledge should lead to fewer bugs. (Whether that's a more practical approach is another question).
- pron 10y agoThat's the wrong context :) He was talking about McCarthy's later discussion of what he called "situations", and is similar to temporal logic (which came later). Functional programming doesn't satisfactorily address the state change problem.
- kazinator 10y agoLisp is built on OOP: all sorts of objects that have state and functions operating on it. For instance, an I/O stream, needed to do the "read" and "print" parts of REPL, is a stateful object. Lisp is not only where functional programming originated, but also object-based programming leading to OOP. Lisp was the first language which had first-class objects: encapsulated identities operated upon by functions, and having a type. For instance, an object of CONS type could only be accessed by the "getter" functions CAR and CDR which take a reference to the object, and by the "setters" RPLACA an RPLACD. Meanwhile, the other higher level programming language in existence, Fortran, had just procedures acting on global variables.
- dang 10y agoI was interested to notice that Steele and Sussman describe Lisp as "an object-oriented language" on page 2 of this 1979 paper: https://dspace.mit.edu/bitstream/handle/1721.1/5731/AIM-514.pdf https://dspace.mit.edu/bitstream/handle/1721.1/5731/AIM-514..... There are other places in the Lambda papers and whatnot where they talk about objects, but I don't recall seeing that exact phrase. Of course, just what they meant by it is another question.
- di4na 10y agohttps://news.ycombinator.com/item?id=13036663 https://news.ycombinator.com/item?id=13036663 I answered here. I linked the paper by McCarthy at the end.