Re: Reason why generators do not have references to themselves?

2014-01-27 Thread David Herman
I'd like to suggest another sense in which you may have gone down a bad path: you're assuming that await is paired with function*, but it could instead be (like C#) paired with its own async-function syntactic form. Let's say for the sake of argument that async is just a keyword that takes a

Re: Reason why generators do not have references to themselves?

2014-01-27 Thread Erik Arvidsson
On Jan 27, 2014 2:09 PM, David Herman dher...@mozilla.com wrote: I'd like to suggest another sense in which you may have gone down a bad path: you're assuming that await is paired with function*, but it could instead be (like C#) paired with its own async-function syntactic form. Let's say for

Re: Reason why generators do not have references to themselves?

2014-01-27 Thread Bradley Meck
Could not get the example deferred function to work with traceur from the wiki page to see what it generates. https://github.com/google/traceur-compiler/wiki/LanguageFeatures Been talking off list since this is off topic, but keeps coming up. I ended up following Brendan's advice. I have a

Re: Reason why generators do not have references to themselves?

2014-01-27 Thread Brendan Eich
Bradley Meck wrote: Unsure on how new syntax features like await should deal w/ multiple operands though, like if await wanted to turn multiple promises into an array. Comma operator takes comma separated list out of the equation. No one proposed this. Do you have a use-case? Task.js and

Re: Reason why generators do not have references to themselves?

2014-01-27 Thread Bradley Meck
This is more just a comment / thinking out loud about syntax. Not related to a specific use case. The following is just what was starting to bring my thoughts around to that though. I am starting to build things with the constructs in this thread, so building out things in a similar manner to

Re: Reason why generators do not have references to themselves?

2014-01-25 Thread Claude Pache
Le 24 janv. 2014 à 10:06, Bradley Meck bradley.m...@gmail.com a écrit : (...) I still have to use new when invoking the generator function which feels dirty in my mind. Interestingly, using `new` when invoking a generator function feels cleaner in my mind. :-) In short (and since it is

Re: Reason why generators do not have references to themselves?

2014-01-24 Thread David Herman
On Jan 23, 2014, at 4:49 PM, Brendan Eich bren...@mozilla.com wrote: Domenic Denicola wrote: Task.js is still on JavaScript1.8, and is not ES6-compatible. It won't work with modern browsers, or with Regenerator. Fork and fix, should be easy. I expect a PR would be accepted in due course.

Re: Reason why generators do not have references to themselves?

2014-01-24 Thread Bradley Meck
Taking note with async polyfills and syntax for a minute. I spent a fair amount of time actually writing the spec of my intent/goal after getting some thought and working things through in my head (varies slightly from old 2011 await):

Re: Reason why generators do not have references to themselves?

2014-01-24 Thread Domenic Denicola
It seems like this is largely a matter of personal aesthetics (feels dirty, hacky, etc.) but nothing is wrong or even hard functionally. Furthermore given the prevalence of code out there that uses such hacks without compunction, it seems that your aesthetics are not shared by most. Maybe the

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Mark S. Miller
When writing a generator as, for example, an instance method of a class, it would be very surprising for its 'this' to be bound to something other than the class' instance. On Thu, Jan 23, 2014 at 2:14 PM, Bradley Meck bradley.m...@gmail.comwrote: I was playing around with generators / looking

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Andrea Giammarchi
arguments.callee.caller would have done that /trolling /but-actually-not-so-much On Thu, Jan 23, 2014 at 2:14 PM, Bradley Meck bradley.m...@gmail.comwrote: I was playing around with generators / looking at await for promises and notices a very difficult thing revolving around generators not

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Brendan Eich
Andrea Giammarchi wrote: arguments.callee.caller would have done that /trolling /but-actually-not-so-much No, Bradley wants the generator-iterator (what ES6 draft calls a Generator), not the generator function (GeneratorFunction). Any .callee would have to be a function, so a

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Domenic Denicola
Task.js is still on JavaScript 1.8, and is not ES6-compatible. It won't work with modern browsers, or with Regenerator. On Jan 23, 2014, at 19:43, Brendan Eich bren...@mozilla.com wrote: Bradley Meck wrote: Is that true even though then should fire after the generator unwinds its stack?

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Brendan Eich
Domenic Denicola wrote: Task.js is still on JavaScript1.8, and is not ES6-compatible. It won't work with modern browsers, or with Regenerator. Fork and fix, should be easy. I expect a PR would be accepted in due course. SpiderMonkey seems to have ES6 generator support somewhat there

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Allen Wirfs-Brock
On Jan 23, 2014, at 2:14 PM, Bradley Meck wrote: I was playing around with generators / looking at await for promises and notices a very difficult thing revolving around generators not having a reference to themselves. See: https://gist.github.com/bmeck/72a0f4f448f20cf00f8c I have

Re: Reason why generators do not have references to themselves?

2014-01-23 Thread Brandon Benvie
On 1/23/2014 4:46 PM, Domenic Denicola wrote: Task.js is still on JavaScript 1.8, and is not ES6-compatible. It won't work with modern browsers, or with Regenerator. For most uses, Task.js's Task.spawn can be replaced with a smaller helper function: ```js function spawn(thunk) { return