From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 49C5CBC57 for ; Wed, 7 Jul 2010 22:48:11 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag8CAGeENEzRVaE0mGdsb2JhbACgEAgVAQEBAQEICQwHESKvK4IMhWcuiFMBAQMFCIUXBINz X-IronPort-AV: E=Sophos;i="4.53,554,1272837600"; d="scan'208";a="54664147" Received: from mail-fx0-f52.google.com ([209.85.161.52]) by mail2-smtp-roc.national.inria.fr with ESMTP; 07 Jul 2010 22:48:11 +0200 Received: by fxm8 with SMTP id 8so33787fxm.39 for ; Wed, 07 Jul 2010 13:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=EsFg2LEhYmovGGkPFufJIvR8cUhEPl6sIb9/zdNRcTA=; b=QQINn9W2x1WO+SsMRGHjOFIkpNkyxkwKHpiHVNzjj9uA0vyEeJqxoPnWBZrBq6NoDM fVsyfGUQ1gAsD11KPlyP2RocBKhK4Cxle1NYCruEkBWKukk6enDB9F1zbqpUj9T/JPz4 GlhbOIcr+nH3c8yOspFXywf1f2TX4wRmWt+DM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=xAeijWhpsZX8US3loEqvk1Y1A7DmxQp0sQDtsoVscJM5ei8MGhUQO6CzK3a+E7hZWE /y1qN9zm6E55MLXPXUPeg5/QEuyYPBjm4DqgpmRaGYAF5C4J9T7tEQqdXHdbQdFSuU7k j1jcLOv9t0D50sNObqOUPDrqs3fpQX0wawEzM= Received: by 10.223.115.201 with SMTP id j9mr6327033faq.59.1278535690622; Wed, 07 Jul 2010 13:48:10 -0700 (PDT) Received: from debian ([79.114.97.139]) by mx.google.com with ESMTPS id i1sm15272628faa.5.2010.07.07.13.48.10 (version=SSLv3 cipher=RC4-MD5); Wed, 07 Jul 2010 13:48:10 -0700 (PDT) Date: Wed, 7 Jul 2010 23:48:06 +0300 From: =?UTF-8?B?VMO2csO2aw==?= Edwin To: OCaml List Subject: Re: [Caml-list] Binding the Lua library [was: adding a scripting language to an ocaml program] Message-ID: <20100707234806.17b77e82@debian> In-Reply-To: References: <4C339FE3.6000402@citycable.ch> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 guillaume:01 guillaume:01 doable:01 ocaml:01 translating:01 bytecode:01 edwin:98 28,:98 userdata:98 userdata:98 5.1:98 garbage:01 closures:01 incremental:01 On Wed, 7 Jul 2010 22:36:28 +0200 Paolo Donadeo wrote: > On Tue, Jul 6, 2010 at 23:28, Guillaume Yziquel > wrote: > >> And, of course, any ideas or help on the garbage collector(s) > >> issue are welcome. > > I do not know much about Lua's GC. My experience (for R, Python and > > Java) is that it's doable. > > The GC implemented in Lua [1] is an incremental mark-and-sweep > collector. Since Lua type system is simple (nil, boolean, number, > string, function, userdata, thread, for coroutines, and tables) it > automatically collects everything without problems. The strategy for > basic types is to copy values from the C (or OCaml) side to the Lua > stack: this copy decouples the two GC and sets them free to deallocate > values. > > Problems arise when one tries to share userdata or closures between > OCaml and Lua. In this case it's not clear (at least to me) how to > approch the problem. > > > > [1] http://www.lua.org/manual/5.1/manual.html#2.10 How about translating a program in lua (or lua bytecode) to OCaml sourcecode automatically? Would that be possible? Best regards, --Edwin