From: "Jörg W Mittag" Date: 2010-02-06T06:35:10+09:00 Subject: Re: embedding ruby Josep Pujol wrote: > After reading a little, I found out that ruby was not designed with > embedding in mind. However, I really love Ruby and I would like to embed > it into my application. It is true that Ruby wasn't designed with embedding in mind. However, this ... > I would like to know if the problem with embedding ruby is that there > are global variables and also because of the stack. ... has absolutely nothing to do with that. What you are asking about has nothing to do with Ruby, this kind of behavior is specific to the particular implementation you are using. Rubinius was very much designed for embedding. It doesn't have any global variables or other sort of global state and it minimizes its use of the C stack as far as possible. It also has a well-defined embedding API. (In earlier versions, it didn't use the C stack *at all*, but that was changed for performance and interoperability reasons.) JRuby also is easy to embed, and it also has a well-defined embedding API. It supports the scripting API which is part of the Java Platform Specification, and also its own scripting API (RedBridge). IronRuby supports the standard DLR embedding API and can be easily embedded. If you look at the actual commandline interpreter binaries for JRuby and IronRuby, you will find that they are just pretty simple commandline wrappers around the engines, using the respective embedding APIs. Personally, I would look at Rubinius, JRuby or IronRuby for embedding, rather than MRI or YARV. But really, I would look at Lua, because while you can find a Ruby *implementation* that is specifically designed for embedding, this doesn't change the fact that the Ruby *language* isn't. jwm