Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

dangerous references?

 [1/2] from: maximo::meteorstudios::com at: 24-Jul-2003 9:44


hi, can anyone tell me if the following is a possible bug in hiding? ;-------------------------------------------------------------------------------- ; create an object a: make object! [ b: "some text" c: func [arg][print arg print b] ] ; extract a function from it obj-func: get in a 'c ;loose pointer to object! a: none ; execute function of lost object obj-func ;----------------------------------------------------------------------------------- will the GC eventually make this code unstable, or will it know not to trash object a because one of its members is being used somewhere else? -max ----------- meteor Studios, T.D. ----------- Strong enough for a man, but made for a woman

 [2/2] from: g:santilli:tiscalinet:it at: 24-Jul-2003 16:11


Hi Maxim, On Thursday, July 24, 2003, 3:44:54 PM, you wrote: MOA> will the GC eventually make this code unstable, or will it MOA> know not to trash object a because one of its members is MOA> being used somewhere else? By definition, REBOL contexts have indefinite extent: basically, as long as there's a word bound to it, a context is not destroyed. So you can use the code above safely. (Note: this wasn't the case for /Core 2.0, that due to a bug would have trashed such contexts even if they were still needed.) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/