How about encompass stores the old function name and function definition in a list maintained within itself, so you can /restore later. Just an idea.
Anton. > Hi all, > > > I just wanted to let everyone know of a nifty function I just > uploaded to the rebol.r repository, it is called emcompass. > > I wanted to share it here, but its too large and will wordwrap > pretty badly... > > http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=en > compass.r > > There are a lot of comments in the code (per my usual coding style) > > It lets you add code around a function and wraps all refinements > to it. It is a follow up to the question I asked a week ago > about transfering all refinements to another function of the > same/lesser template. > > 'ENCOMPASS can be used to modify behaviour of code, without > actually tampering with the code itself. It is especially > usefull in patching native! funcs. > > simply put you can: > -extend the argument list by adding new parameters or refinements, > -add pre-process code, executed before the function you are enclosing. > -add pos-tprocess code, executed after the function you are enclosing. > -the return value (if any) of the enclosed function can be > created/modified in the > post-process, which is in turn returned by the encompassing function. > > the example within the rebol.org encompass.r script show how you > can add a confirm on every 'read done, in the case where you want > to monitor and intercept what a script is about to read, just > before it does. Canceling the read, terminates the script. > > the example even adds a refinement to read /safe which prevent > any confirmation when you know the file is safe. > > the patch replaces the global read statement, so calling this at > the begining of your code actually protects you from someone > prying files on your disk and sending them over the net without > your knowledge. > > good thing is that if the template to read changes in the future, > you have nothing to edit, it just continues using the new > template, because you do not have to tamper with it yourself. > > > The example itself is simple, but it shows just how easy it is to > extend/restrict functionality of any function, method, action or native. > > > hope some of you find it usefull, I know I really am! > > > ciao! > > > -MAx > > PS: if some of you noticed it yesterday, I have severely updated > it last night, its worth getting the newer version (1.0.2) > > ------------- > Steel project coordinator > http://www.rebol.it/~steel > ------------- -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.
