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

[REBOL] context of a function Re:(2)

From: fsievert:uos at: 21-Aug-2000 11:21

On Fri, 18 Aug 2000 [brian--hawley--bigfoot--com] wrote:
> Frank Sievert ([fsievert--uos--de]) wrote: > >Is there a way to get the words of the context of a function? > > Not directly. > > >Example: > > f: func [a] [] > > g: func [a] [print a] > > > >Does anyone know a way to change function f AFTER its definition > >in that way, that it will work like function g? > > f: :g
> The contexts of functions are not properly persistent. While > REBOL does save a context for each function, it only does so > for the purpose of reuse. The values of the words in that > context are trounced with every call to the function.
I don't want to get the context, Or the value of the word. I want to get a word bound to the context of the function. That is a difference. make-fun: func [/local a] [ f: func [a] [a] append second :f 'a ]
>> make-fun >> probe :f
func [a] [a a] To serialize function "f" I must have a chance to find out, which of the words are bound to function "f"s context and which not. This binding must be persistent. I think it would be a good idea, if make function! would bind the third and first of the function to functions context. Greetings, Frank