Xbasic

PROPERTY_RECURSE_ASSIGN Function

Syntax

V PROPERTY_RECURSE_ASSIGN(P destination,P source)

Arguments

destination

The name of the destination dot variable.

source

The name of the source dot variable.

Description

Recursive property assignment (for propagating properties instead of referencing them).

Discussion

PROPERTY_RECURSE_ASSIGN() assigns the sub-elements of one "Dot" variable to another. If you set one dot variable to another (e.g. dot_var1 = dot_var2), the sub-elements of the assigned dot variable simply point to the original dot variable's sub-element. However, if you use the PROPERTY_RECURSE_assign() function, the assigned dot variable has its own copy of the sub-elements.

Example

Type the following in the Interactive window:

Family.lastname = "Smith"
Family.father = "John"
Family.mother = "Irene"
Family.children.child1 = "Tim"
Family.children.child2 = "Lara"
b.lastname = ""
property_recurse_assign(b, family)
c = family
? b.lastname -> "Smith"
? c.lastname -> "Smith"
Family.lastname = "Jones"
? Family.lastname -> "Jones"
? b.lastname -> "Smith" (because "B" is its own variable. It does not point to the "Family" dot variable.)
? c.lastname -> "Jones" (because "C" simply points to the "Family" dot variable.)

See Also