rem: var res = func.apply(ns, totalArgs); 
add: var res = func.apply(thisObj, totalArgs); 
context: dojo.lang.curry = function(ns, func /* args ... */){	var outerArgs = [];	ns = ns||dj_global;	if(dojo.lang.isString(func)){		func = ns[func];	}	for(var x=2; x<arguments.length; x++){		outerArgs.push(arguments[x]);	}	// since the event system replaces the original function with a new	// join-point runner with an arity of 0, we check to see if it's left us	// any clues about the original arity in lieu of the function's actual	// length property	var ecount = (func["__preJoinArity"]||func.length) - outerArgs.length;	// borrowed from svend tofte	function gather(nextArgs, innerArgs, expected){		var texpected = expected;		var totalArgs = innerArgs.slice(0); // copy		for(var x=0; x<nextArgs.length; x++){			totalArgs.push(nextArgs[x]);		}		// check the list of provided nextArgs to see if it, plus the		// number of innerArgs already supplied, meets the total		// expected.		expected = expected-nextArgs.length;		if(expected<=0){			var res = func.apply(ns, totalArgs);			expected = texpected;			return res;		}else{			return function(){				return gather(arguments,// check to see if we've been run										// with enough args							totalArgs,	// a copy							expected);	// how many more do we need to run?;			};		}	}	return gather([], outerArgs, ecount);}
meta: 4707	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4707/50c3492c4c3c825dbd3401e134a19ed46799c456/func.js/buggy/www/resources/dojo-ajax/src/lang/func.js