On Friday, April 3, 2015 at 11:29:35 PM UTC+11, Colin Yates wrote: > Thanks for the clarification - I would still be nervous about relying > on the sequencing though as that feels like an implementation detail. > > I am concerned though about the interpretation of "Why? Partially > because handlers are given a snapshot of the app-db and can't be > nested.". This is still a little ambiguous for me - for example, if it > means nested in terms of transactions then it means the opposite of > what you think. > > The above could be read as "each handler is given the _same_ snapshot > of the database" in which case event dispatch sequence is irrelevant, > or "the db is the result of reducing each handler onto the snapshot". > I really should check the code (but head elsewhere ATM). > > On 3 April 2015 at 13:07, Daniel Kersten <[email protected]> wrote: > > Right, I see what you mean. I think I need to think about it some more :) > > > > > > > > On Fri, 3 Apr 2015 at 12:58 Rafał Cieślak <[email protected]> wrote: > >> > >> > That is, have the event control which player it gets applied to. This > >> > way the handler does not need any knowledge of this at all and can use > >> > path > >> > middleware to focus in on only what it cares about (the game board, in > >> > the > >> > case of selecting a cell). > >> > >> I think it's better to fetch the player in the handler, as the cell > >> component itself doesn't care about whose turn it is. > >> > >> But maybe your solution is more FRP-ish, I don't know. ;) > >> > >> -- > >> 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. > > > > -- > > 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.
I'd think about it this way ... Each time an event is handled, these steps occur: 1. The value in app-db is extracted -- let's call that value db. 2. Lookup the handler for the event 3. Call this handler passing in db and v. 4. take the return value from step 3, and put it back into app-db That's the cycle. Only once one cycle is complete, can the next event be handled, by performing exactly the same set of steps. If, during the execution of step 3, another event is dispatched, then it will not be handled until "later" -- in another cycle of the loop above. It is simply queued up. That's what I mean about no nesting. Event handling is done via a FIFO conveyor belt. One event can't be handled in the middle of another one is being handled. -- Mike -- 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.
