[REBOL] Re: Destroy no more useful functions
From: joel:neely:fedex at: 16-Apr-2002 16:42
Hi, Didier,
Here's my preferred approach...
Didier Jacquemart wrote:
> Hello.
>
> I wrote a source file, containing several general purpose functions,
> called funcsrc.r
>
> In a program, i then write
> do %funcsrc.r
> .... calling funcs
>
> When my program ends, i want to destroy all the funcs included by
> funcsrc.r. But writing unset 'func1, unset 'func2 ... is a bit
> boring and much unsure.
> Has anybody an idea ?
>
Assuming that funcsrc.r contains a related collection of functions,
modify funcsrc.r so that it defines a single object having all of
those functions as members/methods.
REBOL [
...
]
make object! [
func1: func [...] [...]
func2: func [...] [...]
...
]
You can use this in the following manner:
fns: do %funcsrc.r
fns/func1 ...
fns/func2 ...
...
then, at the end of the useful life for the function library
unset 'foo
or
foo: none
or whatever.
-jn-