3 ms·
> All that said, State Machines are (currently) the one true abstraction for a given program because that is what a computer is, and every program is, to begin
by tuukkah 9y ago
> All that said, State Machines are (currently) the one true abstraction for a given program because that is what a computer is, and every program is, to begin with.
I don't understand these claims. To me, a computer "is" processors that step through memory locations interpreting them as operations and operands - not a state machine. Equally, hardly any program is a state machine.
Is a Haskell program a state machine, or "poorly defined"? I'd suggest other models of computation such as typed lambda calculus provide a much better basis for defining and documenting computer programs.
- viraptor 9y ago> To me, a computer "is" processors that step through memory locations interpreting them as operations and operands - not a state machine. And what is that, if not a state machine with memory? Where the state transitions come from decoding/executing instructions and arguments, and the memory comes from ram/registers. Although yes, that's kind of getting to a similar theoretical level as object = function.
- JustSomeNobody 9y ago> To me >, a computer "is" processors that step through memory locations interpreting them as operations and operands - not a state machine. Each of those operations changes the processor's state based on the current state and the input. Which is what a state machine does/is.
- theincredulousk 9y agoThe immediate side-effects of any program and the processor are only to read, manipulate, and write data. Data is stored in a finite memory that all have states 0 and 1. Every single thing that can be represented or manipulated by a program is just an array of 0s and 1s that are read, manipulated, and written. The values in the array are the state, and everything a program is capable of doing only moves it to a different state of memory. Every single program ever written is a state machine, so is every microchip for that matter. https://en.wikipedia.org/wiki/Turing_machine https://en.wikipedia.org/wiki/Turing_machine
- tuukkah 9y agoI see. I think your argument falls apart when you wave away the differences (e.g. memory) between a finite state machine, a Turing machine and an actual computer. Theoretically, the Turing machine and lambda calculus are equivalent: https://en.m.wikipedia.org/wiki/Church–Turing_thesis https://en.m.wikipedia.org/wiki/Church–Turing_thesis However, in practise, the specifics of programming languages are essential: https://en.m.wikipedia.org/wiki/Turing_tarpit https://en.m.wikipedia.org/wiki/Turing_tarpit When you include the state of the memory in the state of the state machine, the state space explodes, which is more than inconvenient. On the other hand, in lambda calculus and Haskell, you don't have to even think about state.