From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.6 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B6A47BBAF for ; Sun, 21 Jun 2009 20:08:21 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkIDAFcUPkrRVd65lGdsb2JhbACYID8BAQEBCQkKCRGlVY4FAQMCBIQGBYcq X-IronPort-AV: E=Sophos;i="4.42,263,1243807200"; d="scan'208";a="28479045" Received: from mail-pz0-f185.google.com ([209.85.222.185]) by mail2-smtp-roc.national.inria.fr with ESMTP; 21 Jun 2009 20:08:20 +0200 Received: by pzk15 with SMTP id 15so1079822pzk.1 for ; Sun, 21 Jun 2009 11:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:content-transfer-encoding; bh=CwI7O6HqmuF3d38g00BY0Izjx8doAmtPY/PPGys/oi4=; b=gV2BbqBXXn7tVJ/+ErEMjoWbbZDmxYE32tszxJrGjJN6Fz7uGZbKE/GoqVmisT1d6L RIsZGejxhrygAcrR3isxrI9LCPId0TYdOOgMTE4Fqv3cBOIyvZAf08vJD9VEMTMui/0a JXOuxB5cH/fu4SN8fcKsK6jDtnIoiT1FPWeQA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=qSQYJC5Bhvw/d+TTlPSYmNJH7DI4gLIBsDJdIyzmwBFGQUZipXgMLvaLYQiBz2UH8C hVLrmutuhfliiz0wD107vSRzCz5J2wrmPtV+4XDtQ+rQCfGJ+9yvS0Bhr4b01sDL1oUJ P7x7mNhTSmeF/gGbJbupQEU25JSvch6cVqIvQ= MIME-Version: 1.0 Sender: jake.donham@gmail.com Received: by 10.142.134.20 with SMTP id h20mr2315124wfd.342.1245607700046; Sun, 21 Jun 2009 11:08:20 -0700 (PDT) In-Reply-To: <91F6B99D-3075-47A1-9257-0BD208C6D5D8@erratique.ch> References: <4A3BCE1A.3010403@citycable.ch> <91F6B99D-3075-47A1-9257-0BD208C6D5D8@erratique.ch> From: Jake Donham Date: Sun, 21 Jun 2009 11:08:00 -0700 X-Google-Sender-Auth: 2343feed52f6ebf8 Message-ID: Subject: Re: [Caml-list] Re: Obj.magic and existential types. To: OCaml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; existential:01 bunzli:01 buenzli:01 dependencies:01 recomputed:01 20,:98 2009:98 javascript:98 wrote:01 caml-list:01 int:01 let:03 let:03 daniel:04 daniel:04 On Sat, Jun 20, 2009 at 1:30 AM, Daniel B=FCnzli 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 re= act > 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 =3D return 1;; let i =3D return 0;; let _ =3D i >>=3D fun i -> let m =3D n >>=3D fun x -> return (x + 1) in print_int (read m); return ();; let () =3D let iref =3D 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