Help with removing __iterator__ from JS

2015-07-21 Thread Tom Schuster
Hello! We have an old JS extension that allows objects to modify how they behave when used with for-in. However this extension will never make it into ES6 and is actually incompatible with how iteration is defined there. So please don't use __iterator__anymore. I would really appreciate your help

Re: Help with removing __iterator__ from JS

2015-07-21 Thread David Rajchenbach-Teller
If I recall correctly, the difficulty with the OS.File removal is that some clients of this code were taking advantage of the old API in ways that do not match the new one. I will try and take another look at it over the summer. Cheers, David On 21/07/15 13:07, Tom Schuster wrote: > Hello! > >

Re: Help with removing __iterator__ from JS

2015-07-22 Thread Paolo Amadini
On 7/21/2015 12:07 PM, Tom Schuster wrote: Aside: Please also try avoid using Iterator(). What would be the alternative to Iterator() when I need to iterate and easily assign both keys and values of an object to local variables? See for example

Re: Help with removing __iterator__ from JS

2015-07-22 Thread David Bruant
Hi Paolo, The ES6 iterator protocol is what you're looking for. See: * https://hacks.mozilla.org/2015/04/es6-in-depth-iterators-and-the-for-of-loop/ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator Alongside with the computed property syntax,

Re: Help with removing __iterator__ from JS

2015-07-23 Thread Paolo Amadini
On 7/22/2015 1:56 PM, David Bruant wrote: The ES6 iterator protocol is what you're looking for. See: Alongside with the computed property syntax, you should be able to achieve what you want. Something along the lines of: Well, I was thinking more of something built-in, other than Iterator, to a

Re: Help with removing __iterator__ from JS

2015-07-23 Thread Boris Zbarsky
On 7/23/15 7:29 AM, Paolo Amadini wrote: Well, I was thinking more of something built-in, other than Iterator, to achieve the same effect over a data structure (for example something that could be provided from elsewhere as an argument). Paolo, I might be missing something, but why is __iterat

Feel free to use Iterator() in privileged JS (was: Re: Help with removing __iterator__ from JS)

2015-07-28 Thread Paolo Amadini
On 7/23/2015 4:16 PM, Boris Zbarsky wrote: I might be missing something, but why is __iterator__ and the nonstandard iteration protocol needed for this? It's not. I don't think anyone on the SpiderMonkey end particularly cares whether Iterator or some replacement is used. Thanks a lot for t

Re: Feel free to use Iterator() in privileged JS (was: Re: Help with removing __iterator__ from JS)

2015-07-28 Thread Tom Schuster
Please remember that the ES6 iteration protocol can only be used with for-of. On Jul 28, 2015 1:20 PM, "Paolo Amadini" wrote: > On 7/23/2015 4:16 PM, Boris Zbarsky wrote: > >> I might be missing something, but why is __iterator__ and the >> nonstandard iteration protocol needed for this? >> > > I