Delete an Instance of an Object
[1/3] from: info::id-net::ch at: 29-Sep-2002 22:56
How Can I delete an instance of an object ?
Philippe Oehler
[2/3] from: greggirwin:mindspring at: 29-Sep-2002 15:47
Hi Philippe,
<< How Can I delete an instance of an object ? >>
Remove all references to it. The garbage collector will take care of the
rest. (If I understand the question that is)
--Gregg
[3/3] from: joel:neely:fedex at: 29-Sep-2002 17:02
Hi, Philippe,
Can you supply a little more detail?
Philippe Oehler wrote:
> How Can I delete an instance of an object ?
>
In the simple case of something like
myword: make object! [...]
you can simply evaluate
myword: none
or any other expression that destroys the reference to the
object. However AFAIK the object isn't really eligible for
garbage collection until all references have gone away. If
you other references, then it's not yet garbage. For example,
foo: make object! [...]
gorp: make block! 10
loop 10 [
insert tail gorp make foo [...]
]
myword: first gorp
creates a situation in which evaluating either (one) of
myword: none
or
gorp: none
still leaves another reference to the first object created
from FOO.
Does that address your question, or am I missing something?
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]