[REBOL] Re: Confused over Contexts
From: nitsch-lists:netcologne at: 22-Dec-2001 21:15
RE: [REBOL] Re: Confused over Contexts
> Hi Volker
> > difference is, functions share the context for their locals,
> > only saving/restoring content for recursion.
> > so if a function gives a word to the outside,
> > all blocks share the same word.
> > with context a real new word is created each time.
> > also RT says they may cange function-behavior,
> > setting all locals to none on return.
> > so using locals in code which "lives" after return may break then.
> I think that in this case 'context works only because layout reduce the
> block. In other cases, the fact that none of func, use, context duplicate the
> body, would take to shared context.
yes, the block is copied by layout.
otherwise it would be [context copy/deep [..]]
but the point is, all this copied blocks use the same local words
in the same context.
so one needs to create a new context for each layout.