Transactions can be carried out on base variables as well as member variables. The following rulesa pply:
The table below uses the variable names a[] and b[] which may also be replaced with array or structure member variables of any hierarchical depth. This flexible setup allows you to shape up your
variable trees as you like.
Transaction | Symbol | Example | Description |
---|---|---|---|
Copy | <== | a[] <== b[]; | Step 1: If a[] does not yet exist, then it will be created. Otherwise, the variable will be initialized, including deleting all members. Step 2: Value from b[] to a[] will be copied like in an assignment. Step 3: All members and sub-members will be copied from b[] to a[]. |
Copy Members | <==^ | a[] <==^ b[]; | Step 1: If a[] does not yet exist, then it will be created. Otherwise all members will be deleted. The base variable will be preserved. Step 2: Will be skipped. Step 3: Like above. |
Move | <<= | a[] <<= b[]; | Steps 1-3: Like the copy-transaction Step 4: Deletes variable b[] entirely including its members. If a member variable is specified on the right-hand side, then that member variable with its sub-members will be deleted. |
Move Members | <<=^ | a[] <<=^ b[]; | Steps 1-3: Like the copy-members-transaction Step 4: Deletes all members and sub-members of variable b[], but the base variable remains unaffected. If a member variable is specified on the right-hand side, then those sub-members will be deleted. |
Swap | <=> | a[] <=> b[]; | Swaps all contents (base variable and all members and sub-members) between the two variables |
Swap Members | <=>^ | a[] <=>^ b[]; | Swaps all members (and sub-members) between the two variables, but the base variables are not swapped. |
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
animals1[] = Mikes collection;
b[] = My pets;
a[] <== animals1[];
b[] <==^ animals1[];
see(a[]);
see(b[]);
a[] Mikes collection (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)
b[] My pets (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
animals2[] <== animals1[]; // Make a copy
animals1[] = Mikes collection;
b[] = My pets;
a[] <<= animals1[];
b[] <<=^ animals2[];
see(a[]);
see(b[]);
echo("animals1[] existing? ", existing(animals1[]));
see(animals2[]);
a[] Mikes collection (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)
b[] My pets (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)
animals1[] existing? false
animals2[] [Void] (void,full access)
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
array ( plants1[], { tulip, sunflower, fir } );
animals1[] = Pets and animals;
plants1 [] = Plants and flowers;
animals2[] <== animals1[];
plants2 [] <== plants1[];
animals1[] <=> plants1[];
animals2[] <=>^ plants2[];
see( animals1[] );
see( plants1[] );
see( animals2[] );
see( plants2[] );
animals1[] Plants and flowers (softquoted string,full access)
Array [ 0] tulip (softquoted string,full access)
Array [ 1] sunflower (softquoted string,full access)
Array [ 2] fir (softquoted string,full access)
plants1[] Pets and animals (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)
animals2[] Pets and animals (softquoted string,full access)
Array [ 0] tulip (softquoted string,full access)
Array [ 1] sunflower (softquoted string,full access)
Array [ 2] fir (softquoted string,full access)
plants2[] Plants and flowers (softquoted string,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
herbivore deer (softquoted string,full access)