From: Gaspard Bucher <gaspard@teti.ch>
To: David MENTRE <dmentre@linux-france.org>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocaml for embedding
Date: Fri, 9 Jul 2010 12:29:01 +0200 [thread overview]
Message-ID: <AANLkTilMoTaSw5jEWH1pCrZIv1vZPGQGIdDkqj4ZpSb9@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimSpG6n24H_i6KK0bwNvi-ns5R-cQYePf6XCyUn@mail.gmail.com>
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 <dmentre@linux-france.org> wrote:
>
> Hello,
>
> 2010/7/8 Gaspard Bucher <gaspard@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
next prev parent reply other threads:[~2010-07-09 10:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 21:02 Gaspard Bucher
2010-07-09 7:06 ` [Caml-list] " David MENTRE
2010-07-09 10:29 ` Gaspard Bucher [this message]
2010-07-12 9:14 ` David MENTRE
2010-07-12 13:19 ` Gaspard Bucher
2010-07-20 0:36 ` Eray Ozkural
2010-07-20 15:02 ` Eray Ozkural
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTilMoTaSw5jEWH1pCrZIv1vZPGQGIdDkqj4ZpSb9@mail.gmail.com \
--to=gaspard@teti.ch \
--cc=caml-list@yquem.inria.fr \
--cc=dmentre@linux-france.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox