On Wed, Nov 9, 2011 at 4:20 PM, Brendan Eich <bren...@mozilla.com> wrote:

> On Nov 9, 2011, at 1:15 PM, Dean Landolt wrote:
>
> On Wed, Nov 9, 2011 at 4:05 PM, Brendan Eich <bren...@mozilla.com> wrote:
>
>> On Nov 9, 2011, at 12:40 PM, Jorge wrote:
>>
>> > On 08/11/2011, at 22:17, John J Barton wrote:
>> >> Just as a point of comparison, I use this form:
>> >>  Object.keys(o).forEach( function(key) {
>> >>     body
>> >>  });
>> >
>> > By the way, isn't that above a(nother) good use case for a goto, given
>> that there's no (easy) way to break out of a forEach 'loop' ?
>>
>> "goto" as in C, from body to a label in the outer function or script?
>> Seriously?
>>
>> You could always use try/catch/throw, but who would?
>>
>
>
> Umm, es-next, right? In a way, isn't this what StopIteration is? :)
>
>
> No, that's almost entirely under the for/of hood. The number of users who
> have to manually catch in order to write schedulers is miniscule compared
> to the population who'll write loops, comprehensios, and generator
> expressions.
>
>
> Still, it's a whole lot nicer to just let the language do your try/catch
> wrapping where you can.
>
>
> Yes.
>
>
> And if you need to break out of forEach, just, umm, don't use forEach.
> It's the wrong tool for the job.
>
>
> Clearly people like the forEach array extra in conjunction with
> Object.keys.
>


Aye, but I suspect that's because many people don't realize that `some` is
a superset of forEach, and IIUC is for *exactly* this use case. I bet this
lack of awareness of the rest of the array extras will be improved with
time -- I don't think it lends much support to any argument for fancy new
control flow semantics.



> With block-lambdas they could have their cake and break from it too
>


That's what I'm afraid of :-/


(and the call would be paren-free to boot).
>
> /be
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to