Version française
Home     About     Download     Resources     Contact us    
Browse thread
Obj.magic and existential types.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] Re: Obj.magic and existential types.

Le 19 juin 09 à 20:47, Jake Donham a écrit :

> You can also find FRP in froc (which is quite similar to React; the
> main difference is that it works in browsers):

Theoretically React may also work in browsers via o'browsers (http://ocsigen.org/obrowser 
) but I never tried.

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).

Best,

Daniel

The following froc program consumes an unbounded amount of memory :

> open Froc_afp;;
>
> let n = return 1;;
>
> let () =
>   while true do
>     let m = n >>= fun x -> return (x + 1) in
>     print_int (read m);
>     Gc.full_major ();
>   done

The following equivalent react program consumes a bounded amount of  
memory :

> open React;;
>
> let n, _ = S.create 1
>
> let () =
>   while true do
>     let m = S.map (fun x -> x + 1) n in
>     print_int (S.value m);
>     Gc.full_major ();
>   done
>