From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: guillaume.yziquel@citycable.ch
Cc: OCaml List <caml-list@inria.fr>
Subject: Re: React switch with newly created events.
Date: Wed, 23 Dec 2009 22:23:50 +0900 [thread overview]
Message-ID: <91a3da520912230523w74ff5fe8i9b0f8eb9f2c015c7@mail.gmail.com> (raw)
In-Reply-To: <4B320EFA.9050609@citycable.ch>
> However, it may happen (and it does happen) that as soon as this new
> React.event is created, an event is fired before the React.E.switch has been
> executed to replace the old event by the new event.
You are creating a new update cycle inside another update cycle and
this is disallowed. No primitives are allowed to update in an update
cycle (to be precise unless the primitive does not belong to the
dependency graph of the update cycle).
> -1- clutter my code with mutexes to synchronise the whole stuff, with the
> disadvantage that there is not, to my knowledge, to execute a function just
> after the React.E.switch function has effectively switched events.
I don't understand what you are saying (a word must be missing). But
yes you need to serialize the updates, see
http://erratique.ch/software/react/doc/React#update but I guess you
already know that.
.
> -2- look for a way in React to do it within React only. Which would mean to
> somehow implement within React a way to switch to a newly created event,
> without race conditions.
You can perfectly switch to a newly created event, primitive or not.
If the event is not a primitive it may even have an occurence in the
same update cycle (e.g. if the dynamic creation depends on the
updating primitive itself). However if it's a primitive event it
cannot have an occurence in the same update cycle as this would start
a new update cycle and this is disallowed.
Daniel
next prev parent reply other threads:[~2009-12-23 13:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 12:37 Guillaume Yziquel
2009-12-23 13:23 ` Daniel Bünzli [this message]
2009-12-23 13:54 ` Guillaume Yziquel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91a3da520912230523w74ff5fe8i9b0f8eb9f2c015c7@mail.gmail.com \
--to=daniel.buenzli@erratique.ch \
--cc=caml-list@inria.fr \
--cc=guillaume.yziquel@citycable.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox