|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 19-Oct-2010 Edit History|
Copy context by setting values in the target from those in the source.
from [block! integer!] - Only specific words (exports) or new words in target (index to tail)
/all - Set all words, even those in the target that already have a value
The resolve function is used to merge values from one context into another but avoids replacing existing values.
It is used mainly to support runtime environments, where newly exported functions must be merged into an existing lib context. Because lib can become quite large, performance must be optimized, which is the reason why resolve is a native function.
This example will help to show the basic concept:
obj1: object [a: 10] obj2: object [b: 20] append obj1 'b resolve obj1 obj2 print obj1 a: 10 b: 20
obj1: object [a: 10] obj2: object [a: 30 b: 20] append obj1 'b resolve obj1 obj2 print obj1 a: 10 b: 20
So, resolve has no affect on values that have already been set in the target context.
Note that protected words will not be modified, they are ignored. No error occurs.
|/only||only affect word values that are provided in a block argument that follows this refinement. In addition, this refinement also supports a special optimization where you can indicate the index of the starting point for changes. That is useful with large contexts such as lib and others.|
|/all||forces resolve to change all values, not just those that are unset. This is similar to append on an object! except that the source is an object, not a block.|
|/extend||any words not found in the target context will be added. This eliminates the append step that was shown above (or a similar bind step). This refinement optimizes such operations.|
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|