From: Austin Ziegler Date: 2004-06-28T11:29:50+09:00 Subject: Re: Is it considered Harmful? On Mon, 28 Jun 2004 06:20:04 +0900, Sean O'Dell wrote: > On Sunday 27 June 2004 13:44, Patrick May wrote: > > Is the problem that you want to add methods? Then use Modules. > This is a good question. In the past, I've wished I could change objects into > a different state, sort of like taint or freeze, but with a little more > customization. For example, taking a File object and replacing all of its > write methods to custom ones that log everything written. It can be done by > adding methods (and removing methods ones you don't want to be available > anymore), but I thought a really super simple way to handle the situation is > to simply replace the entire class of the object, so you control 100% what > methods are available. That way, if the File object got passed to some other > method out of your control that called a method you forgot to replace or > remove, the method wouldn't even be there. I think that Matz is going to provide a much better facility for this sort of thing with the :pre and :post method wrappers (AOP-style programming). The only valuable form of object replacement, IMO, is replacing a proxy object with a real object. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca