Re: That First Next Argument

2014-08-21 Thread Andy Wingo
On Wed 20 Aug 2014 19:55, Brendan Eich bren...@mozilla.org writes: Kevin Smith wrote: function *echo() input { while (true) yield input.value; } So input is bound to the next() actual parameter value on each resumption. That's not bad shed-coloring! Andy, Dave: WDYT? I

Re: Promise() vs. new Promise()

2014-08-21 Thread Salvador de la Puente González
The only problem I see here is you can not emulate completely `new` with ES. Why Promise add some internal slots when called with new and it does not make the same when writing `var p = Object.create(Promise.prototype); Promise.call(p, fn);`? On Thu, Aug 21, 2014 at 5:18 AM, Andrea Giammarchi

Re: Promise() vs. new Promise()

2014-08-21 Thread Andrea Giammarchi
Agreed, and not only Promise. AFAIK there is no way to detect if a generic constructor is a typeof 'class' or just a function, then invokable through a well known, commonly used pattern as `Generic.call(obj, p1, p2)` is when it comes to generics initializations. This is also a precedent that

Re: Re: Status/Thoughts on Guards?

2014-08-21 Thread Charles Pick
Just to throw another example out there, here's a Design by Contract library which squeezes itself within existing ES syntax - https://github.com/codemix/contractual ___ es-discuss mailing list es-discuss@mozilla.org

Re: Status/Thoughts on Guards?

2014-08-21 Thread Curtis Steckel
These are all great examples and resources. Thanks everyone. On Thursday, August 21, 2014, Charles Pick char...@codemix.com wrote: Just to throw another example out there, here's a Design by Contract library which squeezes itself within existing ES syntax -

Re: Promise() vs. new Promise()

2014-08-21 Thread Tab Atkins Jr.
On Thu, Aug 21, 2014 at 2:03 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: This is also a precedent that suggest `Object.create(Generic.prototype)` is useless when the `Generic` is ES6 class due inability to initialize it later on: a very bad news for prototypal inheritance.

Re: Promise() vs. new Promise()

2014-08-21 Thread Andrea Giammarchi
It will not if you have ```js function Foo() { Bar.call(this); } ``` as generic way to extend classes in your old style logic, something that will inevitably fail the moment you do `Foo.prototype = Object.create(Bar.prototype);` with `Bar` that comes from ES6 and it has been defined as

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread C. Scott Ananian
On Thu, Aug 21, 2014 at 11:00 AM, John Barton johnjbar...@google.com wrote: Finally, it would be ideal if we could also adjust those dependencies on the fly, since if we're reflecting dependencies described in the mutable DOM structure, it might be mutated. I think this one is technically

instantiate() deps list

2014-08-21 Thread John Barton
The Loader instantiate() function is described: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reflect.loader.prototype.instantiate Based on that description I assume that the 'deps' property returned by instantiate() meant dependencies that would be loaded by the loader. That is, one

Re: Promise() vs. new Promise()

2014-08-21 Thread C. Scott Ananian
On Thu, Aug 21, 2014 at 3:22 AM, Salvador de la Puente González sa...@unoyunodiez.com wrote: The only problem I see here is you can not emulate completely `new` with ES. Why Promise add some internal slots when called with new and it does not make the same when writing `var p =

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread John Barton
On Thu, Aug 21, 2014 at 8:37 AM, C. Scott Ananian ecmascr...@cscott.net wrote: On Thu, Aug 21, 2014 at 11:00 AM, John Barton johnjbar...@google.com wrote: Finally, it would be ideal if we could also adjust those dependencies on the fly, since if we're reflecting dependencies described in

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread C. Scott Ananian
On Thu, Aug 21, 2014 at 11:54 AM, John Barton johnjbar...@google.com wrote: On Thu, Aug 21, 2014 at 8:37 AM, C. Scott Ananian ecmascr...@cscott.net wrote: Where? The Load Request records imply a dependency graph. Are these maintained though out the life of the page? I don't see any existing

Re: Promise() vs. new Promise()

2014-08-21 Thread Allen Wirfs-Brock
On Aug 20, 2014, at 7:30 PM, Andrea Giammarchi wrote: I like the `Function.prototype.new` hint but unless it's an implicitly self bound method you still cannot easily pass it around as callback for a map without binding it all over. `arr.map(MyClass.new)` without needing to explicitly bind

Re: That First Next Argument

2014-08-21 Thread Allen Wirfs-Brock
On Aug 21, 2014, at 12:04 AM, Andy Wingo wrote: On Wed 20 Aug 2014 19:55, Brendan Eich bren...@mozilla.org writes: Kevin Smith wrote: function *echo() input { while (true) yield input.value; } So input is bound to the next() actual parameter value on each resumption.

Re: That First Next Argument

2014-08-21 Thread Kevin Smith
I've been thinking about ways to explicitly place the initial yield. One ideal is a reserved keyword sequence starting with 'yield`, such as `yield continue` to mark the initial yield point. If a generator function does not contain an explicit `yield continue`, then it is implicit at the

Re: That First Next Argument

2014-08-21 Thread Brendan Eich
Andy Wingo wrote: On Wed 20 Aug 2014 19:55, Brendan Eichbren...@mozilla.org writes: Kevin Smith wrote: function *echo() input { while (true) yield input.value; } So input is bound to the next() actual parameter value on each resumption. That's not bad

Re: That First Next Argument

2014-08-21 Thread Brendan Eich
Kevin Smith wrote: I've been thinking about ways to explicitly place the initial yield. One ideal is a reserved keyword sequence starting with 'yield`, such as `yield continue` to mark the initial yield point. If a generator function does not contain an explicit `yield

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread Ian Hickson
On Thu, 21 Aug 2014, C. Scott Ananian wrote: On Thu, Aug 21, 2014 at 11:54 AM, John Barton johnjbar...@google.com wrote: Where? The Load Request records imply a dependency graph. Are these maintained though out the life of the page? I don't see any existing reason to expect these are

Re: Comprehensions, Where Art Thou?

2014-08-21 Thread Owen Densmore
Where are [methods called .lazy(), .concat(), .map(), .filter(), and .flatMap()] defined? Is it intended that .map() and .flatMap() will be defined on all iterables? Just in case it wasn't obvious from the repo, these are defined in traceur.init.js. ​ Lovely style.​ I have to admit that the

Re: Promise() vs. new Promise()

2014-08-21 Thread Andrea Giammarchi
I guess you haven't read the following code that does that in ES5 fashion :-) mixing up syntax ``` Object.defineProperty( Function.prototype, 'new', { configurable: true, get: function () { return Object.defineProperty( this, 'new', {value:

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread Russell Leggett
Not sure if my real world use case would be super helpful here, but just in case, here it is. The app I work on is a very large single page app - over 150,000 lines of JS across more than 2000 files. Uncompressed, unminified, and concatenated together, it weighs in at close to 10MB. We've been

Re: That First Next Argument

2014-08-21 Thread Allen Wirfs-Brock
On Aug 21, 2014, at 9:54 AM, Brendan Eich wrote: Andy Wingo wrote: On Wed 20 Aug 2014 19:55, Brendan Eichbren...@mozilla.org writes: Kevin Smith wrote: function *echo() input { while (true) yield input.value; } So input is bound to the next() actual

Re: That First Next Argument

2014-08-21 Thread Kevin Smith
Also, write your echo generator this way. You have to duplicate code. Ah, of course - thanks for reminding me. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: That First Next Argument

2014-08-21 Thread Claude Pache
Le 20 août 2014 à 10:42, Andy Wingo wi...@igalia.com a écrit : On Tue 19 Aug 2014 08:48, Claude Pache claude.pa...@gmail.com writes: Le 19 août 2014 à 06:47, Kevin Smith zenpars...@gmail.com a écrit : It appears that the current state of affairs is that the argument supplied to the

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread Ian Hickson
On Thu, 21 Aug 2014, John Barton wrote: I think your graph is upside down from mine ;-) As I learned it, leaf nodes were the ones at the ends of branches and hence were not dependent on any other nodes; no node depended on a root node. I don't really mind which way we view the graph. To

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread John Barton
On Thu, Aug 21, 2014 at 1:55 PM, Ian Hickson i...@hixie.ch wrote: On Thu, 21 Aug 2014, John Barton wrote: ... more misunderstanding about bundles skipped... Let's give upon discussing bundles and pursue your dependency list scheme. I don't think it should be particularly complex. It

Re: That First Next Argument

2014-08-21 Thread Allen Wirfs-Brock
On Aug 21, 2014, at 10:42 AM, Allen Wirfs-Brock wrote: On Aug 21, 2014, at 9:54 AM, Brendan Eich wrote: Andy Wingo wrote: On Wed 20 Aug 2014 19:55, Brendan Eichbren...@mozilla.org writes: Kevin Smith wrote: function *echo() input { while (true) yield input.value;

Re: Bundling vs sending serialized dependency graph

2014-08-21 Thread Ian Hickson
On Thu, 21 Aug 2014, John Barton wrote: I'm not sure what you mean here. The list returned from instantiate is treated the exact same way as the list auto-discovered from import statements when instantiate returns undefined: it's passed to ProcessLoadDependencies(), which calls