T. Onoma schrieb:
> Thanks Pit. Just to be clear, I am indeed attempting to accomplish exactly 
> what my original example pretends to do. I have some modifications for the 
> the core ruby libs (like Object) and I was hoping that I could encapsulate 
> them in a namespace and then "reload" them into the toplevel at a later point 
> in execution.  In effect gaining (somewhat) dynamically controllable core 
> class modifications. While not nearly as concise as I had hoped, your 2nd 
> example above can be made to do the job. Thanks!

Ah I see.

If you want to add/modify some singular methods then you could implement the 
namespaces not as modules but simply as files, which you require/load 
dynamically. Not as nice as modules but maybe still useful.

If you want to add functionality spanning more than one class then maybe Object 
Teams (http://www.objectteams.org) is what you're looking for. Ther's also a 
Ruby implementation. With Object Teams, you express a concept as a "team" of 
objects working together (one of their examples is the observer pattern with the 
"roles" observable and observer). Then you can "connect" those teams to existing 
classes, thereby adding new behaviour to them.

Regards,
Pit