I wanted to use it in a module for an application to run (currently) very
simple scripts. The thing is that the app is multithreaded and several
instances of this module could run concurrently executing different scripts.
The scripts right now just look like this:
They are automatically generated but eventually I will write new ones by
hand and that’s where the flexibility of Ruby would come in handy. the calls
that are made in the scripts end up calling wrapped C/C++ functions.
If I have something like
script1: x = foo()
script2: x = bar()
I don’t want the scripts to actually share the variable x. They should be
visible only in the scope of the particular script. Maybe there’s a way of
wrapping these scripts inside a Ruby module through a preprocessor so that
they are isolated from each other?
From: Sean Middleditch [mailto:firstname.lastname@example.org]
Sent: Monday, June 10, 2002 9:49 AM
Subject: Re: multiple instances of Ruby interpreter in my C++ code?
Ruby makes use of a lot of global values - there is no way of doing this
in Ruby currently.
What reason do you have for wanting multiple instances? There may be
another way of accomplishing your goal(s).
On Mon, 2002-06-10 at 09:42, Thorsten Scheuermann wrote:
I’m new to Ruby and am currently trying to embed Ruby in a C++ program. It
is pretty straightforward and I’ve already had some success with that.
However, what I really want is to have several independent instances of
interpreter running. Lua for example makes this easy by encapsulating the
interpreter state in a C struct, but I didn’t see that facility in Ruby.
there any way to accomplish this?