# Embedded ruby limitations

**URL:** <https://www.ruby-forum.com/t/embedded-ruby-limitations/48212>\
**Category:** Ruby\
**Created:** [November 17, 2005, 8:04pm UTC](https://www.ruby-forum.com/t/embedded-ruby-limitations/48212 "2005-11-17T20:04:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![derek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@derek](https://www.ruby-forum.com/u/derek)\
**Post date:** [November 17, 2005, 8:04pm UTC](https://www.ruby-forum.com/t/embedded-ruby-limitations/48212/1 "2005-11-17T20:04:39Z")

</div>

I really want to embed ruby in a new app. However, the limitation  
of one interpreter per process is too limiting and possibly  
dangerous for what i want to do.

Is this limitation being addressed? I might be willing to wait a  
short while if the limitation were to be removed. However, it looks  
like i probably need to go with something like Python or TCL or LUA.  
I’d really prefer ruby but i’m not sure i have that option.

Thanks,  
Derek

---

<div class="post-metadata">

**Author:** ![derek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@derek](https://www.ruby-forum.com/u/derek)\
**Post date:** [November 18, 2005, 7:27pm UTC](https://www.ruby-forum.com/t/embedded-ruby-limitations/48212/2 "2005-11-18T19:27:00Z")

</div>

derek wrote:

> I really want to embed ruby in a new app. However, the limitation  
> of one interpreter per process is too limiting and possibly  
> dangerous for what i want to do. [snip]

What are you expecting (your users?) to do in Ruby that could require  
multiple interpreters? Are you writing a web app using a not-ruby-aware  
framework, so you need to have separate “contexts” for different users  
of the app?

---

<div class="post-metadata">

**Author:** ![derek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@derek](https://www.ruby-forum.com/u/derek)\
**Post date:** [November 18, 2005, 10:48pm UTC](https://www.ruby-forum.com/t/embedded-ruby-limitations/48212/3 "2005-11-18T22:48:40Z")

</div>

> What are you expecting (your users?) to do in Ruby  
> that could require multiple interpreters? Are you  
> writing a web app using a not-ruby-aware framework,  
> so you need to have separate “contexts” for different  
> users of the app?

(pardon my Windows-centric terminology)

Imagine a command shell that can run individual Ruby commands  
maintaining a persistent Ruby environment. For example (given a syntax  
of “%@ruby[” \<ruby\_statement\> “]”):

```
%@ruby[b = 42]
%@ruby[p b]

```

would print 42 on the console, and then

```
%@ruby[`set q=#{b**3}`]

```

would set the environment variable q to 74088 - _back in the calling  
environment_.

Meanwhile, the shell would be able to directly run Ruby scripts, but  
might well want to run them in a fresh, clean environment, as is done  
by invoking ruby.exe on a script. And after the script has finished,  
the b would still be 42 in the command shell’s persistent Ruby  
environment.

– Timothy

---

<div class="post-metadata">

**Author:** ![derek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@derek](https://www.ruby-forum.com/u/derek)\
**Post date:** [November 18, 2005, 11:09pm UTC](https://www.ruby-forum.com/t/embedded-ruby-limitations/48212/4 "2005-11-18T23:09:51Z")

</div>

On Nov 18, 2005, at 1:47 PM, Timothy Byrd wrote:

> syntax  
> environment\*.
> 
> Meanwhile, the shell would be able to directly run Ruby scripts, but  
> might well want to run them in a fresh, clean environment, as is done  
> by invoking ruby.exe on a script. And after the script has finished,  
> the b would still be 42 in the command shell’s persistent Ruby  
> environment.

I think irb’s workspaces work this way.
