Closed kuraga closed 9 years ago
No.
Object.observe
allows you to observe changes, however that requires you to mutate your state object. If you read the observ-*
source code, you find that all mutation methods actually make shallow copies.
The ability to "observe" state is less important then the ability to keep the state immutable.
UPD: It's clear now, thanks to @kristianmandrup. We do mutate a state's reference. But don't mutete state. Like in git. Every commit is immutable. We mutate HEAD only.
Original question: Where does immutability end and does mutability start?
Facts:
1a) we set new value
property
1b) and then get new state
via event (channel), i.e. not from previous render
;
2) leaves are mutable.
So, do we store current state
? Where? So, do we change it? Do we mutate it? Or do we mutate state
reference but not the state
object, do you mean?
You don't want to mutate EVER (IMO)! See clojure, datomic etc. Mutable programs were mostly "invented" for ease of use and limited memory back in the day... a mutable app doesn't scale, causing too many problems as it grows...
https://thechangelog.com/rich-hickeys-greatest-hits/ http://www.datomic.com/videos.html https://vimeo.com/97408202
We are finally rethinking our whole approach to computing, leveraging our much improved infrastructure. Save current state in Datomic, simple source of truth. See also: datomicjs ;)
Hey folks,
can we replace
observ-*
dependencies with aObject.observe
technique in the future?What's your thoughts?