Message from JavaScript discussions
April 2017
— For instance, modifying flyweight.tuple
directly modifies the objects being traversed
The tuple
is an object with named properties referencing the objects being traversed at the same time and the value being iterated
— So if a clone algorithm needs to use this traversal function and, say, keep parity between the clone's accessor and the original's accessor, it can simply add to the tuple, starting with the root node before calling next
:
// Set Clone Object Root
tuple.clone = cloneRoot;
— The tuple looks like this on the inside:
{original: [Object], search: [Object]}
and anything added to this will go to two places: 1 being a
map
of known nodes, and 2 being a stack which the iddfs uses for navigation
— Which means... if the node is encountered again, say because multiple properties refer to it, then the tuple that was added when the node was first encountered will then be supplied back to the caller
— I am also a woman :D Hello
— Not a lot of us in these groups, lol
— Are you at school for it or self learning?
— I highly reccomend taking advantage of all MDN has to offer here: https://developer.mozilla.org/en-US/docs/Learn/JavaScript
— No problem :>
— Sure
— This is amazing, albeit very abstract, what are you using this for?