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

[REBOL] Re: [bind] Use example

From: nitsch-lists:netcologne at: 23-Apr-2004 16:54

On Freitag, 23. April 2004 10:30, Coussement Christophe wrote:
> Hi list, > > 'bind could perhaps solve a context problem I'm facing. > Could anyone give me some example of use of 'bind and 'bind/copy, and the > reason to use this solution ? >
You have a a: context[ b: 2 c: 3 : d: 4] You have a block of words, like block: [b c d] And you want this words looked up in this context. similar to a/b a/c etc. Then you say bind block in a 'b And now all words in the block are bound to 'a. (words not in 'a are unchanged.) So get first block returns 2. Note you give a reference-word in a context, not the context itself. that way you can also bind to function-argument, where you don't have a context-handle. (with newer betas for 1.3 you can also give the context directly, like bind block a ; instead of "in a 'b" or "in a 'self" ) This ist most usefull to execute code in a context, say you want to execute it using a special set of functions. Most of the time you are using 'bind implicitely, as 'func and "make object" use it automaticly. sometimes you want that feature without funcing or making, then 'bind can rescue you.
> TIA > > ==christophe