Peer-nodal.as
// ISSUES // - associations (maintained class:instance relationships) // - get should use class content as default - resolve() doesn't // so either add get/set which use resolve, or remove object-freedom and have only .data
// NODAL PROPERTIES // idcount is a accumulating-only counter for locally-unique-id number // nodes is the current number of instantiated node objects // queue is the root reduction queue nodal = { queue: [], idcount: 0, nodes: 0 };
// NODAL METHODS // - the delete-list is only needed for limited list-space env // - Actionscript failed ref-as-hashkey test, // so we use a id (locally unique identifier) as a lookup-key // - no delete currently // - just get/set properties with normal object-accessor way // - but keep all hierarchy nodal
// Resolve creates if non existent and returns reference to result nodal.resolve = function( context, path ) { while( path.length ) { var key = path.shift(); if ( context[key.id] == null ) { this.nodes++; var node = { queue: [], id: this.idcount++ }; context = context[key.id] = node; } else context = context[ key.id ]; } return context; };
// Consume one quanta // - each quantum is actually two, one for local instance, one for global class // - all instance-loops work by going cd this.current then assigning this.current.next to it // when a function executes, it can update the loop at that location (equiv to array.push) // - a functions parameters (and even further methods and tools) are child associations // the structures necessary to build the fucntion are child assocs too nodal.reduce = function( context ) {
if ( node = context.queue.pop() ) {
// is there a local declaration? // - if yes, execute it and also reduce( class ) // - if no, { reduce( node ) if it has a queue, back to root if not }
}
// Old ECMA SIC reduction for ( var i = 1; i == 1; ) { var queue = cwd.queue; if ( queue.length > 0 ) { var todo = queue.shift(); if ( next = typeOf( todo ) == 'function' ? ( i = todo.call ) : ( cwd = todo ) ) queue.push( next ); } else i = 0; } };