# Modular Ruby

**URL:** <https://www.ruby-forum.com/t/modular-ruby/78756>\
**Category:** Ruby\
**Created:** [March 8, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/modular-ruby/78756 "2006-03-08T22:46:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bernhard\_SelvenS\_St](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@Bernhard\_SelvenS\_St](https://www.ruby-forum.com/u/Bernhard_SelvenS_St)\
**Post date:** [March 8, 2006, 10:46pm UTC](https://www.ruby-forum.com/t/modular-ruby/78756/1 "2006-03-08T22:46:25Z")

</div>

Hi.

Im looking for a framework or some other means of un-/loading ruby code  
into  
a live interpreter. Im thinking along the lines of TCLs interp command  
here, which instanciates a new slave interpreter completely unrelated to  
the main one, apart from a user-defined interface procs/methods. The  
slave  
interpreter even can source other files and load binary libs without  
affecting the main interpreter.

I guess it can be done via Threads and a sufficent high $SAFE value,  
though  
that would still leave the possibility of polluting the namespace of  
other  
threads, wouldn’t it?

Reason for all this is a module system that takes class code from files  
in  
order to extend functionality of the main program. Though i’d settle for  
a  
working way of unloading cleanly without leaving stuff in namespace (if  
the  
module author adheres to set interface regulations, of course).

Thanks.

---

<div class="post-metadata">

**Author:** ![Bernhard\_SelvenS\_St](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@Bernhard\_SelvenS\_St](https://www.ruby-forum.com/u/Bernhard_SelvenS_St)\
**Post date:** [March 8, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/modular-ruby/78756/2 "2006-03-08T23:04:58Z")

</div>

Bernhard, I am working on such a “sandbox” for the Pandora project.  
It’s not done, yet, but when it does, it will allow “client side” Ruby  
programming through a browser using an object-oriented application  
framework. The Pandora wiki engine is pretty solid, and you can  
download here:

[http://pandora.rubyveil.com/pandora/Pandora/Project/Downloads](http://pandora.rubyveil.com/pandora/Pandora/Project/Downloads)

Best regards,

Julian I. Kamil [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://pandora.rubyveil.com/](http://pandora.rubyveil.com/) - Document publishing and web application  
framework  
[http://books.rubyveil.com/](http://books.rubyveil.com/) - The Ruby Bookshelf

---

<div class="post-metadata">

**Author:** ![Bernhard\_SelvenS\_St](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@Bernhard\_SelvenS\_St](https://www.ruby-forum.com/u/Bernhard_SelvenS_St)\
**Post date:** [March 8, 2006, 11:41pm UTC](https://www.ruby-forum.com/t/modular-ruby/78756/3 "2006-03-08T23:41:30Z")

</div>

2006/3/8, Bernhard ‘elven’ Stoeckner [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> that would still leave the possibility of polluting the namespace of other  
> threads, wouldn’t it?
> 
> Reason for all this is a module system that takes class code from files in  
> order to extend functionality of the main program. Though i’d settle for a  
> working way of unloading cleanly without leaving stuff in namespace (if the  
> module author adheres to set interface regulations, of course).

I think this is not possible using plain ruby because you can always  
access constants in gobal scope. If you control your plugins you can  
use anonymous classes that register themselves somewhere. If the  
registration is deleted their code is no longer accessible.

Other than that I guess you’ll need to modify the interpreter in C  
code - or create multiple interpreters.

HTH

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![Bernhard\_SelvenS\_St](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@Bernhard\_SelvenS\_St](https://www.ruby-forum.com/u/Bernhard_SelvenS_St)\
**Post date:** [March 9, 2006, 12:05am UTC](https://www.ruby-forum.com/t/modular-ruby/78756/4 "2006-03-09T00:05:57Z")

</div>

Robert K. scribbled on Wednesday 08 Mar 2006 23:40:

> Kind regards
> 
> robert
> 
> –  
> Have a look: [Robert K. | Flickr](http://www.flickr.com/photos/fussel-foto/)

Thought so. Well, I guess I’ll fiddle around with a TCL-like-approach  
involving a C base framework managing multiple ruby interpreters  
sometime  
soon.

Gut Nacht 🙂
