Ruby embedding limitations

From: "Timothy J. Wood" <tjw@...>
Date: 2002-08-24 03:29:23 UTC
List: ruby-core #363
   There are a couple of basic problems with Ruby's embedding support 
given the system that I want to build.

   First off, it looks like it is currently impossible to reinitialize 
the entire Ruby environment.  For example, in the game I'm working on, 
I want the game logic to be scripted and I want people to be able to 
add their own game types by defining a set of modules and classes.  
When I switch between game types, I'd like to start off with a totally 
clean slate (including changing the search path that Ruby uses to load 
modules).  I suppose I could try to manually clean stuff up, but I 
worry that I won't be able to get everything (especially threads and 
such that the user might have started).

   A closely related problem is the fact that Ruby doesn't allow you to 
create multiple runtimes.  This would be a pretty dramatic change 
(basically involving changing all API points to take a big 'globals' 
block).  I'd like to be able to do this to create servers that can run 
multiple game types at once (in different threads, one thread per Ruby 
engine).

   I can live without the second capability, but the first one really 
worries me.  Can anyone suggest a way to guarantee that you're 
environment is totally cleaned up?

   One of the things I like about Python's embedding interface is the 
fact that you can shut it down and restart it.  Of course, I like the 
Ruby language better, so I'm torn.... :)

-tim

In This Thread

Prev Next