Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How does BIND work?

bind
0
10 Posted

How does BIND work?

0

BIND takes a block of words and BINDs them into the current context. It takes a word from the context you want to BIND to as its second argument. Try playing with this example: REBOL [ Title: “BIND Demo” ] global: on x: 1 y: 2 z: 3 local-context: func [/local context][ use [x y z ] [set [x y z] [a b c] print bind [x y z] ‘context] ] global-context: func [][ use [x y z] [set [x y z] [a b c] print bind [x y z] ‘global] ] local-context global-context halt LOCAL-CONTEXT prints a b c GLOBAL-CONTEXT prints 1 2 3 LOCAL-CONTEXT’S BIND is actually redundant. GLOBAL-CONTEXT’s BIND uses the word ‘global to cause the values of X Y and Z be set to their values where the word ‘global is defined, which happens to be out in the global context. You may also BIND to other contexts besides the global context.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123