Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jake Donham <jake@donham.org>
To: OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: Obj.magic and existential types.
Date: Sun, 21 Jun 2009 11:08:00 -0700	[thread overview]
Message-ID: <c7e4e9f0906211108u5d636f50nb2589943cda214ba@mail.gmail.com> (raw)
In-Reply-To: <91F6B99D-3075-47A1-9257-0BD208C6D5D8@erratique.ch>

On Sat, Jun 20, 2009 at 1:30 AM, Daniel
Bünzli<daniel.buenzli@erratique.ch> wrote:
> Theoretically React may also work in browsers via o'browsers
> (http://ocsigen.org/obrowser) but I never tried.

I have not tried either, but from a cursory glance at the code I have
the impression that React's space safety relies on support for weak
references, which standard Javascript does not have.

> Correct me if I'm wrong but from my perspective froc is different from react
> in that it leaks memory (see example below) and is less thread friendly
> (because it uses global datastructures).

Less thread-friendly, sure. Leaks memory, yes in your example, but in
a less contrived usage, where dead references are underneath a bind,
froc cleans up after itself. E.g.:

  open Froc_afp;;

  let n = return 1;;
  let i = return 0;;

  let _ = i >>= fun i ->
    let m = n >>= fun x -> return (x + 1) in
    print_int (read m);
    return ();;

  let () =
    let iref = ref 0 in
    while true do
      incr iref;
      write i !iref;
      propagate ();
      Gc.full_major ();
    done;;

As before a new value of m is created each time around the loop, but
since it is under the bind of i, froc is able to clean it up when i's
dependencies are recomputed.

Without weak references I don't know how else to implement space
safety. But I am prepared to be enlightened :). Best regards,

Jake


  reply	other threads:[~2009-06-21 18:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 17:42 Guillaume Yziquel
2009-06-19 18:21 ` Daniel Bünzli
2009-06-19 18:30   ` Guillaume Yziquel
2009-06-19 18:37     ` Daniel Bünzli
2009-06-19 18:47   ` [Caml-list] " Jake Donham
2009-06-20  8:30     ` Daniel Bünzli
2009-06-21 18:08       ` Jake Donham [this message]
2009-06-21 18:39         ` Yaron Minsky
2009-06-22  0:03         ` Daniel Bünzli
2009-06-22  9:19           ` Benjamin Canou
2009-06-22 17:02           ` Jake Donham
2009-06-23  0:24             ` Daniel Bünzli
2009-06-23  0:34               ` Jake Donham
2009-06-23  2:22               ` Jake Donham

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=c7e4e9f0906211108u5d636f50nb2589943cda214ba@mail.gmail.com \
    --to=jake@donham.org \
    --cc=caml-list@inria.fr \
    /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