Interacting with cursors is restricted to render for *consistency*. No one
should be able to mutate the data during render, it's that simple.

In between renders we do not allow interacting with cursors for
*consistency* beyond the few operations covered in the documentation and
docstrings. This is because it's not possible to know who is changing the
state between renders (outside of subscribing to :tx-listen).

On Tue, Apr 8, 2014 at 3:06 PM, William Sommers <[email protected]>wrote:

> > what’s the role of IValue and ICloneable in cursors life?
> Not sure.
>

ICloneable can be converted to cursors for free. IValue exists because for
various reasons you may want to read a *stale* value in an event handler or
go loop or whatever. Generally you should not do this and instead deref.

deref is only allowed outside of render because of ... *consistency*.
During render you have consistent picture of the world. Outside rendering
you do not.

> why do we have to implement ICloneable on Strings (in an immutable
> language!) in order for cursors to work?
> Not sure.


The documentation and the tutorials now specifically state to not do this.
It's only there for people who absolutely are OK with the myriad of issues
around JavaScript natives versus objects for String/Number/Boolean/etc. I
show this only to demonstrate it's possible achieve uniform handling of
values at the leaves of your application state. I don't actually recommend
it in practice.

While I'm not taking pull requests on Om, documentation like this is a
great place for people to start and continue contributing.

Thanks,
David

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to