Hi Gabriele, someone once said "Great minds think alike". There is also another saying: "Fools seldom differ." In either case, I concur with your observations. I also believe that hidden contexts are great solution for this kind of thing. I can't wait to get a version of REBOL whose hidden contexts survive garbage collection. Elan At 12:41 PM 12/10/99 +0100, you wrote: >[EMAIL PROTECTED] wrote: > >> That is understood. I'm talking about how long that staticly contexted 'f >> will remain accessible. My expectation is that as long as some live >> reference to 'f continues to haunt REBOL, 'f should stay alive as well. Of >> course, the value 'f references will be determined by the value last passed >> to the function, in whose context the argument 'f is defined. >> >> Opinions? > >I agree. > >>> g: func [x] ['x] >>> a: g 4 >== x >>> get a >== 4 >>> recycle >>> get a >== 4 >>> b: g 6 >== x >>> get b >== 6 >>> get a >== 6 > >So I was not surprised seeing Ladislav's results. If one uses a >dynamic context, things are different: > >>> g: func [x] [use [y] [y: :x 'y]] >>> a: g 4 >== y >>> b: g 5 >== y >>> get a >== 4 >>> get b >== 5 > >But: > >>> recycle >>> get b >***CRASH*** > >A workaround: > >>> hidden-contexts: make list! 0 >== make list! [] >>> g: func [x] [insert tail hidden-contexts make object! [y: :x (x: 'y)] x] >>> a: g 4 >== y >>> b: g 5 >== y >>> get a >== 4 >>> get b >== 5 >>> recycle >>> get b >== 5 >>> get a >== 4 > >Ciao, > /Gabriele./ >o--------------------) .-^-. (----------------------------------o >| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | >| GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | >o--------------------) `-v-' (----------------------------------o > > >
