Why iterators need to be a language-level feature



fluid.toRange = function(target) {
    if (fluid.isArrayable(target)) {
    var index = 0;
    return {
        isEmpty: function() {return index < length;} ,
        popFront: function() {return target[index++];}
        };
    }
    if (typeof(target) === "object") {
        for (var key in target) {
        // urk!!
        }  
    }
}

The JS 1.7 proposal on the MDC is hopelessly broken - https://developer.mozilla.org/en/new_in_javascript_1.7 - but unfortunately we cannot mock up this feature in code - we need either iterators or co-routines (preferably both) in the base language. Roll on JICO (can we implement continuations just with code generation?)