Re: Questions/issues regarding generators

2013-03-15 Thread Dmitry Lomov
In the ideal (from my point of view) world, no object will have both an iterator() and a next() method together (so Iterator and Iterable would be different entities; the first having an internal state, and the second stateless). So your example would be: var iterable = getSomeIterable(); var i =

Re: Questions/issues regarding generators

2013-03-15 Thread Brandon Benvie
On Mar 14, 2013, at 8:01 PM, Andreas Rossberg rossb...@google.com wrote: Yes. Iterators have a next method, that's all what makes them an iterator, according to the wiki, and having an iterator method is never mentioned there. It's mentioned on the iterators proposal page as

Re: Module Loader Comments

2013-03-15 Thread Kevin Smith
Anyway, my questions are cleared up (for now). Can't wait for those wiki updates! ; ) Ah - one more comment. The signatures for `load` and `evalAsync` indicate that they will return `this`, a reference to the loader. These functions are prime candidates for returning futures (e.g.

Re: instantiating generators

2013-03-15 Thread Allen Wirfs-Brock
We discussed the factoring of the generator object model at the Nov 27 meeting. In the notes https://github.com/rwldrn/tc39-notes/blob/master/es6/2012-11/nov-27.md there is a sketch of the hierarchy we agreed to: https://dl.dropbox.com/u/3531958/tc39/generator-diagram-1.jpg The design Andy

Re: instantiating generators

2013-03-15 Thread Axel Rauschmayer
I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions. When I first started experimenting with them in Firefox, it took me a while to figure that out (even though it is obvious in hindsight). With `new`, I’d

Re: Date.parse() sematics / internationalization

2013-03-15 Thread Allen Wirfs-Brock
On Mar 14, 2013, at 3:20 AM, Paul Ruizendaal wrote: There seems to be ambiguity over the semantics of Date.parse() in the spec (both 5.1 and latest 6 draft). The spec says: The String may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the

Re: instantiating generators

2013-03-15 Thread Allen Wirfs-Brock
On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions. When I first started experimenting with them in Firefox, it took me a while to figure that out

Re: instantiating generators

2013-03-15 Thread Brandon Benvie
On 3/15/2013 11:51 AM, Allen Wirfs-Brock wrote: On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don't have strong feelings about it): generators are more like constructors than like functions. When I first started experimenting with them in

Re: instantiating generators

2013-03-15 Thread Axel Rauschmayer
Ah, methods are more tricky! Then you have `this` to contend with. On Mar 15, 2013, at 20:02 , Brandon Benvie bben...@mozilla.com wrote: On 3/15/2013 11:51 AM, Allen Wirfs-Brock wrote: On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don’t have

Re: instantiating generators

2013-03-15 Thread Brandon Benvie
Yeah but since the generator holds the initial |this| for its lifetime you can treat it kind of like a bound function. On Mar 15, 2013, at 12:41 PM, Axel Rauschmayer a...@rauschma.de wrote: Ah, methods are more tricky! Then you have `this` to contend with. On Mar 15, 2013, at 20:02 ,

Re: instantiating generators

2013-03-15 Thread Tab Atkins Jr.
On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions. When I first started

Re: instantiating generators

2013-03-15 Thread Allen Wirfs-Brock
On Mar 15, 2013, at 1:18 PM, Tab Atkins Jr. wrote: On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like

Re: instantiating generators

2013-03-15 Thread Andrea Giammarchi
for what is worth it, agreed with Tab Atkins here ... `new` does not improve much semantically speaking, it's actually just confusing, IMHO On Fri, Mar 15, 2013 at 1:18 PM, Tab Atkins Jr. jackalm...@gmail.comwrote: On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com

Re: instantiating generators

2013-03-15 Thread Tab Atkins Jr.
On Fri, Mar 15, 2013 at 1:22 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Agree that requiring new would be ackward. But permitting it seems reasonable. Yeah, I see no value in making new invalid. ~TJ ___ es-discuss mailing list

Re: instantiating generators

2013-03-15 Thread Brendan Eich
Tab Atkins Jr. wrote: On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 15, 2013, at 11:22 AM, Axel Rauschmayer wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions.

Re: instantiating generators

2013-03-15 Thread Andrea Giammarchi
but then the direction is a bit inconsistent since native constructors are going to require `new On Fri, Mar 15, 2013 at 1:36 PM, Brendan Eich bren...@mozilla.com wrote: Tab Atkins Jr. wrote: On Fri, Mar 15, 2013 at 11:51 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 15,

Re: instantiating generators

2013-03-15 Thread Andrea Giammarchi
(sorry, I sent by accident) I meant native requires `new` and there is already a subset, generators, that are flexible as native constructors are now (e.g. Object() instead of new Object()) anyway, better than mandatory `new` so ... On Fri, Mar 15, 2013 at 1:59 PM, Andrea Giammarchi

Re: Module Loader Comments

2013-03-15 Thread David Herman
That sounds reasonable to me. Dave On Mar 15, 2013, at 11:01 AM, Kevin Smith khs4...@gmail.com wrote: Anyway, my questions are cleared up (for now). Can't wait for those wiki updates! ; ) Ah - one more comment. The signatures for `load` and `evalAsync` indicate that they will

Re: instantiating generators

2013-03-15 Thread Brendan Eich
I don't know what you meant below in the first paragraph, but I'm going to assume you agree that 'new' should not be required for generators. :-|. /be Andrea Giammarchi wrote: (sorry, I sent by accident) I meant native requires `new` and there is already a subset, generators, that are

Re: instantiating generators

2013-03-15 Thread Jason Orendorff
On Fri, Mar 15, 2013 at 11:22 AM, Axel Rauschmayer a...@rauschma.de wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions. When I first started experimenting with them in Firefox, it took me a while to

Where is it specified that new objects are empty, if it is?

2013-03-15 Thread Kevin Reid
I'm doing a little maintenance on SES. Chrome has recently added a new odd behavior: var o = Object.create(null); Object.getOwnPropertyNames(o) [] Object.getOwnPropertyDescriptor(o, '__proto__'); Object {value: null, writable: true, enumerable: false, configurable: false} The two results are

Re: Where is it specified that new objects are empty, if it is?

2013-03-15 Thread Brendan Eich
Kevin Reid wrote: I'm doing a little maintenance on SES. Chrome has recently added a new odd behavior: var o = Object.create(null); Object.getOwnPropertyNames(o) [] Object.getOwnPropertyDescriptor(o, '__proto__'); Object {value: null, writable: true, enumerable: false, configurable: false}

Re: Questions/issues regarding generators

2013-03-15 Thread Waldemar Horwat
On 03/14/2013 04:14 PM, Brendan Eich wrote: Andreas Rossberg wrote: On 14 March 2013 23:38, Brendan Eichbren...@mozilla.com wrote: Andreas Rossberg wrote: That leaves my original proposal not to have generator application return an iterator, but only an iterable. Under that proposal, your

Re: instantiating generators

2013-03-15 Thread Andrea Giammarchi
I agree on that and on top I would rather throw if `new` is used ... but I understand on being permissive, is just weird `Object()` instead of `new Object()` won't be accepted anymore, but for generators there is such exception. This is all I was trying to say. On Fri, Mar 15, 2013 at 3:48 PM,

Re: Where is it specified that new objects are empty, if it is?

2013-03-15 Thread Erik Arvidsson
V8 now uses an accessor on Object.prototype. On Mar 15, 2013 7:20 PM, Brendan Eich bren...@mozilla.com wrote: Kevin Reid wrote: I'm doing a little maintenance on SES. Chrome has recently added a new odd behavior: var o = Object.create(null); Object.getOwnPropertyNames(o) []

Re: instantiating generators

2013-03-15 Thread Axel Rauschmayer
On Fri, Mar 15, 2013 at 11:22 AM, Axel Rauschmayer a...@rauschma.de wrote: I would prefer having to use `new` (but don’t have strong feelings about it): generators are more like constructors than like functions. When I first started experimenting with them in Firefox, it took me a while to

Re: instantiating generators

2013-03-15 Thread Brendan Eich
Andrea Giammarchi wrote: I agree on that and on top I would rather throw if `new` is used ... That might be ok. The newborn passed in as this could be returned via first yield, though, so while it's an odd thing to take advantage of, the semantics of new and function* combine without harm.