3 ms·
I'm sorry, are you arguing that immutability models the world more well than OO because no object in the real world ever stays the same?
by theseoafs 13y ago
I'm sorry, are you arguing that immutability models the world more well than OO because no object in the real world ever stays the same?
- SamReidHughes 13y agoNo need to apologize. With immutability you have to explicitly model temporal changes.
- tomp 13y agoYes. Due to Special Relativity, different observers perceive events (changes to object state) at different moments, the state of the whole universe is not consistent. Therefore, we model the universe using a sequence of immutable universe snapshots, with different computational agents independently moving through the (branching) timeline of snapshots, so that each and every one of them views the universe consistently.
- pmahoney 13y agoMost events humans care about happen in plain old classical physics, and no computer is moving at some large fraction of light-speed relative to any other computer. If you maintain synchronized clocks, everyone can agree on the exact same order of events (which would not be true in a relativistic situation). Now it turns out to be difficult to maintain synchronized clocks, and Lamport timestamps and vector clocks are alternatives. The end result looks similar to a relativistic situation, but (and I'm not a physicist), it seems wrong to claim this situation is because of Special Relativity. Thoughts?
- tomp 13y agoYes. I was half joking, half explaining why immutability actually is better to model the universe. In practice, replace Special Relativity with Network Problems.
- eloff 13y agoSo what you're saying is the universe is mapped COW, and everytime there's a new observer, UniverseOS runs it with fork().
- evanspa 13y agoCheck out the first 20 minutes or so of this SICP lecture. In it, Abelson specifically mentions special relativity as a way for us humans to "model" the real world as immutable values over the continuum of time (in contrast to a mutable world that fits with OO). http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/6a-streams-part-1/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- dustingetz 13y agoImmutable doesn't mean unchanging. It means no mutation. I can throw a ball in the air and model it as a function of time without mutation.