caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Signals of signals in react
Date: Fri, 8 Mar 2013 23:17:45 +0100	[thread overview]
Message-ID: <CAOOOohRtGSg+cTdVpPeY5RVWHX4xodP6F64HMVamzrBG5R2w4w@mail.gmail.com> (raw)
In-Reply-To: <B3006DF47FCC4C54A55FD4B571F49F5C@erratique.ch>

[-- Attachment #1: Type: text/plain, Size: 2178 bytes --]

Hi Daniel and thanks for your detailed answers.


I guess the semantics you want is : [bind_s s sf]_t = [sf [s]_t]_t.
>
that's right.



>
> Well that doesn't seem unreasonable. I remember having pondered a lot
> about which switching combinators to take in the interface and I'm sure I
> must have considered at least :
>
> switch_s : 'a signal signal -> 'a signal
> (* [switch ss]_t = [[ss]_t]_t *)
>
> that would allow for a very easy implementation of bind (switch_s (S.map f
> s)).
>
indeed. I may be happy enough with [switch_s]. I just thought that [bind_s]
would be safer to use, as the user never actually builds a signal of
signal, so he/she cannot mess up with the equality function.


>
> But if it didn't make it *may* be due to thorny signal initialization
> problems. If you look the signature of the current switch it's a way to
> force you to have to give an initial value.

I also thought, as you mention in your second message that it was a way to
prevent users to build signals of signal, because then it is easy to forget
to set the eq parameter and raise exceptions (which are difficult to track
down). If so then let me stress than bind_s helps a little here.



> As a rule of thumb using S.value is never safe if you are inside an update
> cycle, this means that you may get problems if you use bind_s during an
> update cycle itself.

Well yes I have a bind_s called in a function used with S.fix. Now I
understand that I live dangerously here.


>
> It's a little bit irritating as what you want seems really sound to me,
> but I'm afraid you cannot implement it with the current interface without
> providing an initial value yourself.
>
> I don't have the time to investigate right now but I'll surely get back to
> it later to give you a definitive answer.
>
That'd be very kind of you, thanks a lot already for taking time to make
that matter clear to me!

cheers,
ph.

P.S.

If you are interested you may want to have a look at react's imperative
> hell to see if it seems workable. Especially by considering/transforming
> the current S.switch combinator.
>
This is most certainly far beyond my abilities, but I'll definitely have a
look at it!

[-- Attachment #2: Type: text/html, Size: 3172 bytes --]

      parent reply	other threads:[~2013-03-08 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08  9:43 Philippe Veber
2013-03-08 11:51 ` Lukasz Stafiniak
2013-03-08 13:55   ` Philippe Veber
2013-03-08 14:21 ` Daniel Bünzli
2013-03-08 15:02   ` Daniel Bünzli
2013-03-08 22:21     ` Philippe Veber
2013-03-08 22:17   ` Philippe Veber [this message]

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=CAOOOohRtGSg+cTdVpPeY5RVWHX4xodP6F64HMVamzrBG5R2w4w@mail.gmail.com \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.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;
as well as URLs for NNTP newsgroup(s).