From: "Sean O'Dell" Date: 2003-09-12T08:55:12+09:00 Subject: Global object instance? I'm thinking, why do we have globals at all? I wonder if it would be possible to just corral all the "global" stuff (methods, variables, etc.) and just assign all that to a top-level object instance and use that object as the default "global context?" I'm thinking: no fixed global context at all. Just an object instance that acts as the global context. By default, you could "mixin" the Kernel module and that would take care of most the backwards compatibility issues, eh? If not, hopefully you could mixin other modules to finish the job. One advantage I'm thinking of is that you could re-assign the global context to be any object instance, and all global-style references ($variables, ::methods()), would then refer to the new object. So if you had: class NewGlobal include Kernel def initialize @stdout = File::open("capture.txt", File::RDWR|File::TRUNC|File::CREAT) end end .... in one call, you could print to the console: print("this goes to the screen\n) .... then you could switch things up: Global::push(NewGlobal.new) print("this gets captured\n) .... then return to the previous context: Global::pop Kind of a nutty idea, maybe? Sean O'Dell