On Mon, Jan 20, 2014 at 6:20 PM, kovas boguta <kovas.bog...@gmail.com>wrote:

> I'm having a hard time using read.
>
> I find myself using it in 2 places:
>
> 1. Inside the event handler, I want to read, optionally do something
> with the value (typically assoc/dissoc), and put it on a channel.
>
> 2. Inside a go block initialized during will-mount, same story.
>
> The problem is that I do a read, pass the value along, and then when
> the other end of the channel wants to do an operation, I get the
> "Cannot manipulate cursor outside of render phase" error.
>
> If I turn the value into a string before putting it on the channel, I
> don't get the error.
>
> Is this a laziness issue? A bug, or desired behavior? In any case, I
> find it confusing.
>
> Now, here is a leading question: What is the difference between a
> cursor and a reference type?
>
> Instead of having both (value x) and (read x f), why not just @x?
>
> As this question suggests, I also don't understand why both value and
> read are necessary.
>

Om attempts to address consistency issues. Just because you have a cursor
doesn't mean you actually have the most current value in the application
state, thus read. read is always guaranteed to give the latest value. But
if you read only to put the cursor back into an asynchronous channel of
course all bets are off!

To me pipelining cursors into a series of asynchronous operations just
doesn't make any sense, you're bound to end up in an inconsistent state.

Once this is clear then I think we can have discussion about potential
solutions.

Whether we should support deref is orthogonal. And even if we do `value`
might still be useful.

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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to