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 root = { queue: [], idcount: 0, nodes: 0 };
// NODE OBJECT function node() {
root.nodes++; this.id = root.idcount++; this.queue = [];
};
// 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
node.prototype.set( value ) { };
node.prototype.get() { return value; };
// Resolve creates if non existent and returns reference to result node.prototype.resolve = function( path ) { var context = this; while( path.length ) { var key = path.shift(); context = context[key.id] == null ? context[key.id] = new node() : 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 node.prototype.reduce = function() { var context = this; if ( node = context.queue.pop() ) {
// is there a local declaration? // - if yes, execute it and also class.reduce() // - if no, { node.reduce() 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; } };