Hi David !

Thanks for the pointer. From my understanding of the use of
caml_startup (or caml_main), this means that the caml runtime is
global. In Rubyk, each "object" (processing unit) is separated from
all other objects (no globals) so that we can properly encapsulate
operations without side effects and provide fine grained locking
(concurrency is important).

Is there a way to avoid:

1. global locking (or locking only during script recompilation)
2. script level encapsulation

Point (2) would mean that if object "a" contains the script:

 let foo a, b = ... do something

and object "b" contains:

 let foo x, y = ... do something else

The recompilation of script "b" does not change the definition of
function "foo".

One possible solution would be to force the creation of singleton
classes for each script named after the script name (unique):

let script_a = object
  method foo a, b = ...
end;;

let script_b =
  method foo x, y = ... do something else (does not hide script_a::foo)
end;;

This would solve the encapsulation problem, but what about concurrent
calls to ocaml from C ? Is this possible ?

Gaspard

On Fri, Jul 9, 2010 at 9:06 AM, David MENTRE <dmen...@linux-france.org> wrote:
>
> Hello,
>
> 2010/7/8 Gaspard Bucher <gasp...@teti.ch>:
> > 1. Is it possible to embed an ocaml compiler ? (something that eats
> > std::string and produces a callable thing)
>
> No, not the compiler. It is however possible to embed an interpreter
> and to load byte code (and native code?) on demand:
>  http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#toc134
>
> > 2. How would an interface between C++ and a compiled script work ? (passing
> > values, getting return values)
>
> Through a C interface. See above link.
>
> Sincerely yours,
> david

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to