Jason Orendorff wrote:
To make this a little more concrete, just for fun...

Suppose I make an object representing "all future clicks" and give it a map() method. This much, of course, is possible already:

    var clicks = {
        map: function (f) {
            document.addEventListener("click", f);
        }
    };

With Mike's proposal, you could write:

    for (let e of clicks) {
        alert(e.clientX + ", " + e.clientY);
    }

So, just to be clear, now the issue isn't that comprehensions make arrays, it's that iteration isn't X. What is X? Quiz rule: don't say "Monad" or "Monadic" in your answer. :-|


This would desugar to:

    clicks.map(e => {
        alert(e.clientX + ", " + e.clientY);
    });

I don't see why for-of doing magic flatMap*;map is better than this.

And a listener would be attached to the document. The body of the loop would run each time the user clicked.

That's just weird!

Iterators don't do this.

And rightly so!

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to