Thanks - Im trying to understand the code :) so please bare with me..
So when core does this:
#################
function Class(params){
if (params instanceof Function) params = {initialize: params};
var newClass = function(){
Object.reset(this);
if (newClass._prototyping) return this;
this._current = $empty;
var value = (this.initialize) ? this.initialize.apply(this,
arguments) : this;
delete this._current; delete this.caller;
return value;
}.extend(this);
newClass.implement(params);
newClass.constructor = Class;
newClass.prototype.constructor = newClass;
return newClass;
};
#################
This is how I understand it works:
1. it prototypes the newClass with the parameters we put for the
( newClass.implement(params); )
2. Then when a "new" instance is created,
2.1 Object.reset removes all new copies made by step 2 (now belonging
to "this"), by this it now points the instance vars to the function
prototype
2.2 Object.reset creates new object elements and arrays
2.3 But all other instance var types remain pointing to the prototype
Is my understanding correct and I can go to sleep at last? :)
On Feb 7, 1:17 am, Sanford Whiteman <[email protected]>
wrote:
> > @Sandy, how does that work? can you show an example?
> > External link would be great also
>
> Like so:http://mootools.net/shell/mB3E8/
>
> -- Sandy