for own(...) loop (spin-off from Re: for..in, hasOwnProperty(), and inheritance)

Axel Rauschmayer axel at rauschma.de
Wed Nov 9 14:43:15 PST 2011


>> 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. With block-lambdas they could have their cake and break from it too (and the call would be paren-free to boot).

+1

Do block-lamdbas count as a fix for the dynamic this problem? Or are there other plans to get it solved? I would still love to see that happen, it’s a remarkably subtle source of errors. Could functions adopt the block-lambda semantics of picking up the `this` of the surrounding scope when not invoked as methods? It seems like that could work in strict mode where no one expects `this` to have a value.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111109/ab808703/attachment.html>


More information about the es-discuss mailing list