Why not just have a library in Javascript, for example:
Q.each(arr, function(i) {
this.rocks();
arr.pop(); // watch out doing this in the loop
arr.push('foo'); // watch out doing this in the loop
});
Q.each(obj, function(k) {
this.rocks();
delete obj[k]; // should be safe maybe
});
var p = Q.pipe(crazy stuff involving pipes and callbacks)
doSql("SELECT * FROM users", p.fill('users'));
getUsers = Q.getter(getUsers); // turns it into a really smart getter
getUsers = Q.batch(getUsers); // turns into into a batched getter
and lots of other stuffWhy must the language take care of everything for you when libraries can do it? That has been the case with C, C++ and other languages.