@@ -18,17 +18,21 @@ var new_araay = deep_copy(array);
1818var new_struct = deep_copy(struct );
1919
2020// Both have identical values
21- show_debug_message (array);
22- show_debug_message (struct );
23- show_debug_message (new_araay);
24- show_debug_message (new_struct);
21+ show_debug_message (array); // [ { },[ [ 0 ],[ 1 ],[ 2 ] ],{ class : { a : 0, b : 1, c : 2 }, hmm : "hmm", huh : "huh" } ]
22+ show_debug_message (new_araay); // [ { },[ [ 0 ],[ 1 ],[ 2 ] ],{ class : { a : 0, b : 1, c : 2 }, hmm : "hmm", huh : "huh" } ]
23+ show_debug_message (struct ); // { thing : { a : 0, b : 1, c : 2 }, stuff : { thing : { thing : [ 0,1,2 ], stuff : { three : 3, four : 4, five : 5 } } } }
24+ show_debug_message (new_struct); // { thing : { a : 0, b : 1, c : 2 }, stuff : { thing : { thing : [ 0,1,2 ], stuff : { three : 3, four : 4, five : 5 } } } }
2525
2626// But aren't holding the same references
27- show_debug_message (array == new_araay); // false
28- show_debug_message (array[0 ] == new_araay[0 ]); // false
29- show_debug_message (array[1 ] == new_araay[1 ]); // false
30- show_debug_message (array[2 ] == new_araay[2 ]); // false
31- show_debug_message (struct == new_struct); // false
32- show_debug_message (struct .thing == new_struct.thing); // false
33- show_debug_message (struct .stuff == new_struct.stuff); // false
34- show_debug_message (struct .stuff.thing == new_struct.stuff.thing); // false
27+ show_debug_message (array == new_araay); // false
28+ show_debug_message (array[0 ] == new_araay[0 ]); // false
29+ show_debug_message (array[1 ] == new_araay[1 ]); // false
30+ show_debug_message (array[2 ] == new_araay[2 ]); // false
31+ show_debug_message (struct == new_struct); // false
32+ show_debug_message (struct .thing == new_struct.thing); // false
33+ show_debug_message (struct .stuff == new_struct.stuff); // false
34+ show_debug_message (struct .stuff.thing == new_struct.stuff.thing); // false
35+
36+ // And structs are preserving its types so you can use static fields
37+ new_araay[0 ].func(); // hello!
38+ new_struct.thing.func(); // hello!
0 commit comments