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=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 9E078BC6C for ; Mon, 16 Jul 2007 07:35:42 +0200 (CEST) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6G5ZgPu000490 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 16 Jul 2007 07:35:42 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay06.plus.net with esmtp (Exim) id 1IAJFF-0003dN-Br for caml-list@yquem.inria.fr; Mon, 16 Jul 2007 06:35:41 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: CallCC using fork (and garbage collected processes) Date: Mon, 16 Jul 2007 06:30:22 +0100 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707160630.23737.jon@ffconsultancy.com> X-Miltered: at discorde with ID 469B03AE.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; oleg's:01 ocaml:01 ocaml:01 bytecode:01 stack:01 parsers:01 native-code:01 stack:01 finalizer:01 frog:98 invoke:01 garbage:01 invert:01 computation:01 tail:01 Just another crazy idea. So Oleg's callcc for OCaml works by copying the OCaml bytecode stack and its rather nifty because you can trivially control invert parsers and so forth. You can replicate the native-code stack using fork. What if you wrap the forked process in an object and set the finalizer to pass it a message telling it to die. Then you could invoke the process (continuation) to propagate computation. Maybe you can pass your child the pipe from your parent so that it can respond directly and then die yourself (a tail call!). I know this is really silly because you've got the OCaml GC collecting processes (which is even worse than GCing OpenGL textures) but my machine can fork processes pretty quickly and I'm just wondering if anyone's tried it? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e