English version
Accueil propos Tlchargement Ressources Contactez-nous

Ce site est rarement mis jour. Pour les informations les plus rcentes, rendez-vous sur le nouveau site OCaml l'adresse ocaml.org.

Browse thread
Binding the Lua library [was: adding a scripting language to an ocaml program]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-07-07 (20:48)
From: Török Edwin <edwintorok@g...>
Subject: Re: [Caml-list] Binding the Lua library [was: adding a scripting language to an ocaml program]
On Wed, 7 Jul 2010 22:36:28 +0200
Paolo Donadeo <p.donadeo@gmail.com> wrote:

> On Tue, Jul 6, 2010 at 23:28, Guillaume Yziquel
> <guillaume.yziquel@citycable.ch> 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,