3 ms·
Has anyone or any PL theory in CS made a useful distinction between data and state?
by georgeoliver 4y ago
Has anyone or any PL theory in CS made a useful distinction between data and state?
- taneq 4y agoThey're different levels of abstraction. Data is used to describe state.
- Twisol 4y agoState is made of data. The difference is that state is data together with a persistent identity (morally, a location), and the data associated with that identity may change over time.
- bheadmaster 4y agoTuring Machines are defined in a way which makes a distinction between data and state - it consists of a state machine (which controls what happens when each symbol is read) and a tape (which records symbols - data - which will be manipulated). The state machine is part of the Turing Machine's definition - so one Turing Machine can only have one particular state machine configuration, but can operate on any tape with any content. However, the existence of Universal Turing Machine (a Turing Machine that can simulate behavior of any other Turing Machine) demonstrates that data can also represent state - i.e. you can encode an arbitrary Turing Machine's state machine in the tape, without changing the Universal Turing Machine's state machine at all. That's how we got stored program computers. In a more practical sense, a useful distinction between data and state is within the boundaries of the program - any data that is internal to your program can be considered state, while any data that you read from an external source/write to an external sink can be considered just plain data. Separating the two is a helpful technique in writing reliable software.