Hi!
First thanks for your great job, it helps me to make robuste js
framework :)
Just one thing, it is seriously plainfull to integrate your framework
on a existing large
application which uses the for ( var val in array ) structure.
It is sometime not possible to use prototype and it is a shame...
Why not use the delegate pattern encapsuling a [] ?
In that way, we could still use classic Array and powerfull of
prototype.
Code should be something like this :
Abstract.Array = Class.create();
Object.extend(Abstract.Array.prototype, {
initialize: function() {
this.delegate = [];
},
push:function(value) {
this.delegate.push(value);
}
// other Array methods delegate
};
var $A = Abstract.Array.from = function(iterable) {
if (!iterable) return new Abstract.Array();
if (iterable.toArray) {
return iterable.toArray();
} else {
var results = new Abstract.Array();
for (var i = 0; i < iterable.length; i++)
results.push(iterable[i]);
return results;
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---