Re: Iterators, generators, finally, and scarce resources

2014-04-30 Thread Andy Wingo
On Tue 29 Apr 2014 20:35, David Herman dher...@mozilla.com writes: it's a bad smell if code that creates an iterator in a for-of loop head, loops over it, and *never even touches the iterator directly* doesn't shut down the iterator. There are no other objects in JS that have a finalization

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Andreas Rossberg
On 29 April 2014 20:35, David Herman dher...@mozilla.com wrote: On Apr 29, 2014, at 12:40 AM, Andy Wingo wi...@igalia.com wrote: Indeed I expect that in practice most iterators in an ES6 program will be map, set, and array iterators, which in practice will not be implemented with generators.

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Tom Van Cutsem
2014-04-30 3:29 GMT+02:00 Allen Wirfs-Brock al...@wirfs-brock.com: Again, there is nothing new here. At the very least you should look at the old discussion about this. Pointers to the old discussions: I first commented on [[Origin]] as part of my review of the first ES6 draft Proxy spec:

Re: Iterators, generators, finally, and scarce resources

2014-04-30 Thread Kevin Smith
I also note this is the first JS construct that would introduce the notion of resource acquisition and also of implicit finallies. And that is why late changes like this are risky. As far as I know, there's been no published work exploring how this aspect of for-of would interact with

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Mark S. Miller
I don't think I understand the issue. AFAICT, all the system implemented iterators don't need to clean up anything that's not already cleaned up by GC, so they wouldn't need a .return method anyway. Is there a counter-example? On Wed, Apr 30, 2014 at 3:48 AM, Andreas Rossberg

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Mark S. Miller
On Tue, Apr 29, 2014 at 4:32 AM, Kevin Smith zenpars...@gmail.com wrote: I agree with pretty much everything Andy had to say, and would like to add a meta-perspective: We should be viewing this as a last-minute feature request. The churn that this request has introduced is (in my opinion)

RE: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Domenic Denicola
Can someone summarize the argument as to why this can't be added later? Is the  fear that people will create iterators with `return` methods and depend on  those methods *not* being called, but then ES7 would start calling them? ___ es-discuss mailing

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread C. Scott Ananian
Domenic: the argument against is that changing the semantics of `for of` -- and all of the standard library methods, in the case of exceptional exit -- would result in a user-visible change to the state of the iterator. That is, the iterator would not be closed, whereas ES6 as it stands now would

Re: April 10 2014 Meeting Notes

2014-04-30 Thread C. Scott Ananian
On Tue, Apr 29, 2014 at 7:47 PM, David Herman dher...@mozilla.com wrote: Promised you a reply to this one, sorry -- I'm not comfortable with this restriction. It violates my Schemer's intuition [1]. In particular it creates a number of refactoring hazards: (1) add some try/finally [...] [1]

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Mark S. Miller
I'm not concerned about manually added .return methods, nor manual calls to .return methods, though perhaps I should be. If this is a concern, we could solve it by using an @return symbol in ES7 rather than a string name. Neither am I concerned about system iterators, assuming that none of the

Re: Iterators, generators, finally, and scarce resources (Was: April 10 2014 Meeting Notes)

2014-04-30 Thread Andreas Rossberg
I'm not pointing out an issue in particular, just explaining why Andy is right with his specific statement about implementations not using generators (which Dave seemed surprised about, or have misread, I'm not sure). (You are right to assume that built-in iterators would not need .return.)

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Jason Orendorff
On Tue, Apr 29, 2014 at 7:49 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The idea is that a Proxy can define its own property descriptor formats that it exposes to and accepts form user code. vis Object.defineProperty/Object.getOwnPropertyDescriptors. This includes the possibility

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Jason Orendorff
On Tue, Apr 29, 2014 at 8:08 PM, Mark S. Miller erig...@google.com wrote: There aren’t any internal invariant sensitivities that I could find. Once such a non-standard descriptor is never directly used by any of the ordinary object MOP operations I'm surprised and alarmed by this, and it

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Mark Miller
This is a stop-the-train scale disaster. ES6 cannot ship in this state. We need to fix this asap. My apologies for not tracking this issue better earlier. I thought we had all agreed on the constraints, so I did not pay sufficient attention to what I thought was merely the ironing out of minor

Re: Iterators, generators, finally, and scarce resources

2014-04-30 Thread Boris Zbarsky
On 4/30/14, 3:09 AM, Andy Wingo wrote: There are no other objects in JS that have a finalization facility or other shut down semantics. This has actually come up as a problem for DOM objects. Some people actually want a semi-generic facility to say I'm done with you instead of having to

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Erik Arvidsson
This was never resolved and the spec is incomplete here On Wed Sep 25 2013 at 6:17:32 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: So here is another concern, about the scheme we agreed to last week. It needs to match a found own property against the possibility of an own @@unscopable

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Axel Rauschmayer
Specifying the duplicated lookup is doable but a pain. That and the semantic issues WRT proxies makes me a lot less comfortable with the added complexity of supporting @@unscopable. I never liked it. It burdens the language in order to support legacy code. Are there other ways of fixing

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Rick Waldron
On Wed, Apr 30, 2014 at 1:14 PM, Axel Rauschmayer a...@rauschma.de wrote: Specifying the duplicated lookup is doable but a pain. That and the semantic issues WRT proxies makes me a lot less comfortable with the added complexity of supporting @@unscopable. I never liked it. It burdens the

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Erik Arvidsson
On Wed, Apr 30, 2014 at 1:22 PM, Rick Waldron waldron.r...@gmail.comwrote: On Wed, Apr 30, 2014 at 1:14 PM, Axel Rauschmayer a...@rauschma.dewrote: * Hard-coding `with` to ignore only Array.prototype.values. My main use case for unscopable is for DOM. Today we cannot add nice named

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Brendan Eich
Including Tom because proxies and MOP. /be Erik Arvidsson wrote: This was never resolved and the spec is incomplete here On Wed Sep 25 2013 at 6:17:32 PM, Allen Wirfs-Brock al...@wirfs-brock.com mailto:al...@wirfs-brock.com wrote: So here is another concern, about the scheme we agreed

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Tom Van Cutsem
2014-04-30 18:55 GMT+02:00 Mark Miller erig...@gmail.com: This is a stop-the-train scale disaster. ES6 cannot ship in this state. We need to fix this asap. I agree we need to revisit and iron out the details asap, but keep your calm. I'm sure we'll be able to fix this well in time before the

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Axel Rauschmayer
My main use case for unscopable is for DOM. Today we cannot add nice named methods to Element or any of its superclasses since HTML attribute event handlers uses ObjectEnvironments. So Element.prototype is in the variable scope chain of event handlers? Wow. Is this documented somewhere?

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Boris Zbarsky
On 4/30/14, 2:49 PM, Axel Rauschmayer wrote: So Element.prototype is in the variable scope chain of event handlers? Wow. Is this documented somewhere? You mean other than in the spec? See

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Axel Rauschmayer
On 30 Apr 2014, at 21:17 , Boris Zbarsky bzbar...@mit.edu wrote: On 4/30/14, 2:49 PM, Axel Rauschmayer wrote: So Element.prototype is in the variable scope chain of event handlers? Wow. Is this documented somewhere? You mean other than in the spec? See

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Allen Wirfs-Brock
On May 1, 2014, at 2:50 AM, Jason Orendorff jason.orendo...@gmail.com wrote: As specified, proxies can do this: js Object.isFrozen(proxy) true js Object.getOwnPropertyDescriptor(proxy).configurable true No, that is not the intent. However, Object.isFrozen depends upon the

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Allen Wirfs-Brock
Where do you find the spec incomplete WRT @@unscopable. My recollection was that it was all resolved and fully specified and that I was relatively happy with the outcome. Allen On May 1, 2014, at 3:00 AM, Erik Arvidsson erik.arvids...@gmail.com wrote: This was never resolved and the spec is

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread André Bargull
On May 1, 2014, at 2:50 AM, Jason Orendorff jason.orendorff at gmail.com https://mail.mozilla.org/listinfo/es-discuss wrote: / // As specified, proxies can do this: // // js Object.isFrozen(proxy) // true // js Object.getOwnPropertyDescriptor(proxy).configurable // true / No,

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread André Bargull
Where do you find the spec incomplete WRT @@unscopable. My recollection was that it was all resolved and fully specified and that I was relatively happy with the outcome. unscopables for the Object Environment Record is always the empty list. It's never populated. Allen On May 1,

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Erik Arvidsson
On Wed, Apr 30, 2014 at 5:17 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: Where do you find the spec incomplete WRT @@unscopable. My recollection was that it was all resolved and fully specified and that I was relatively happy with the outcome. I thought so too but now that I look at

Re: Object.getOwnPropertyDescriptor can return just about anything

2014-04-30 Thread Jason Orendorff
On Wed, Apr 30, 2014 at 4:06 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On May 1, 2014, at 2:50 AM, Jason Orendorff jason.orendo...@gmail.com wrote: As specified, proxies can do this: js Object.isFrozen(proxy) true js Object.getOwnPropertyDescriptor(proxy).configurable true

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-30 Thread Marcus Stade
I have a use case for `Object.getOwnPropertyDescriptors` – it may or may not be to your liking, but I have one. I'm currently implementing a library to help with employing more pure functional programming techniques in JavaScript environments. This includes such things as (mostly) forcing

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread André Bargull
The changes from https://bugs.ecmascript.org/show_bug.cgi?id=1908 never made it into the spec. On 4/30/2014 11:41 PM, André Bargull wrote: Where do you find the spec incomplete WRT @@unscopable. My recollection was that it was all resolved and fully specified and that I was relatively happy

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Erik Arvidsson
The algorithms in the spec bug uses an object and HasOwnProperty check instead of an array and looping from 0 to length - 1. That has a lot of benefits since there are less things that can go wrong (no getters, no toString etc). However, we might want to change to use HasProperty instead of

Re: ES6 draft Rev24 now available

2014-04-30 Thread Brendan Eich
Want to mention https://github.com/jlongster/es6-macros while this thread is still live. /be Kevin Smith wrote: https://github.com/zenparsing/esparse The actual transpiler is at https://github.com/zenparsing/es6now. I really need to add some documentation, but you can play with

Re: Perhaps @@unscopable shouldn't be a Set...

2014-04-30 Thread Allen Wirfs-Brock
The correct code was in rev21, but somehow got lost in rev22 and later. What is currently in the spec. is essentially what was in rev20. Allen On May 1, 2014, at 7:53 AM, André Bargull andre.barg...@udo.edu wrote: The changes from https://bugs.ecmascript.org/show_bug.cgi?id=1908 never made