Why is sparse still part of the description for [[ArrayIterationKind]]?

2014-01-29 Thread Qantas 94 Heavy
I'm not sure whether this is a bug or it's still open, so I've posted it here first -- sorry if this has already been discussed, I've tried to find related threads and bug reports but to no avail. As of Rev 22 of the ES6 spec, [[ArrayIterationKind]] is described as follows (§22.1.5.3): A string

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Sébastien Cevey
On 29 Jan 2014 03:42, Brendan Eich bren...@mozilla.com wrote: And so we will go with 'chain'. I assume it has been pointed out before that Underscore/LoDash have popularised their own chain function/concept? http://underscorejs.org/#chaining Hopefully it's distant enough from Promise-world to

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Paolo Amadini
While the getMyPromise question wasn't answered yet and still isn't clear to me, from the other posts I think it can be reworded this way: ```js var p1 = Promise.resolve(Promise.cast(1)); var p2 = Promise.cast(Promise.cast(1)); ``` p1 and p2 will have a different internal state, but there is no

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Paolo Amadini
On 29/01/2014 5.12, Kris Kowal wrote: In this case, a half pursuit of type purity is a side quest at the expense of users. Having two ways to resolve and two ways to observe a promise is unnecessarily confusing. In my experience, one method like then, that unwraps recursively, and one

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Quildreen Motta
On 29 January 2014 10:45, Paolo Amadini paolo.02@amadzone.org wrote: On 29/01/2014 5.12, Kris Kowal wrote: In this case, a half pursuit of type purity is a side quest at the expense of users. Having two ways to resolve and two ways to observe a promise is unnecessarily confusing. In my

Re: Promise.cast and Promise.resolve

2014-01-29 Thread Kevin Smith
It is, actually, more simplicity. The concept of `Promise.resolve` and `Promise.chain` is simpler than `Promise.cast` and `Promise.then` (i.e.: they represent orthogonal concepts, not complected). `Promise.cast` and `Promise.then` may be, arguably, *easier* to work with, from a user POV,

Re: Why is sparse still part of the description for [[ArrayIterationKind]]?

2014-01-29 Thread Allen Wirfs-Brock
it's and editorial bug. I forgot to delete that text from the description. Allen On Jan 29, 2014, at 2:38 AM, Qantas 94 Heavy wrote: I'm not sure whether this is a bug or it's still open, so I've posted it here first -- sorry if this has already been discussed, I've tried to find related

restrictions on module import export names

2014-01-29 Thread John Lenz
I'm wondering if this is valid (or should be): // a.js var foo = 1; export foo as 'a.b.c'; // b.js import 'a.b.c' as foo from a.js The reason I ask is Modules appear to support have any valid property name (anything) as an export if the Module is defined directly using newModule.

Re: restrictions on module import export names

2014-01-29 Thread Kevin Smith
// a.js var foo = 1; export foo as 'a.b.c'; // b.js import 'a.b.c' as foo from a.js That is not valid. Export binding names (where you have 'a.b.c') must be IdentifierName. ___ es-discuss mailing list es-discuss@mozilla.org

Re: restrictions on module import export names

2014-01-29 Thread John Lenz
I assume that I can access this like so: var mod = newModule({'a.b.c':1}) use(mod['a.b.c']); It isn't clear to me why imports and export names are restricted. On Wed, Jan 29, 2014 at 8:40 AM, Kevin Smith zenpars...@gmail.com wrote: // a.js var foo = 1; export foo as 'a.b.c'; // b.js

Re: restrictions on module import export names

2014-01-29 Thread Allen Wirfs-Brock
There are still unresolved issues in the Rev22 spec. with the newModule (or possibly new Module) API. t probably needs to say that any property names must conform to IdentifierName. The grammar requirement of IdentifierName is intentional and I don't believe there is any intent to allow that

Re: restrictions on module import export names

2014-01-29 Thread Calvin Metcalf
related, is it possible to export anonymous objects? from looking at the spec it would seem that ```js let foo = 1; export foo as default; ``` would be allowed but ```js export 1 as default; ``` would not so to export an object that doesn't already have a name you'd have to something like:

Re: restrictions on module import export names

2014-01-29 Thread Erik Arvidsson
`export default 1` works. https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports ExportDeclaration : ... export default AssignmentExpression ; On Wed, Jan 29, 2014 at 11:03 AM, Calvin Metcalf calvin.metc...@gmail.comwrote: related, is it possible to export anonymous objects?

Re: restrictions on module import export names

2014-01-29 Thread Jason Orendorff
On Wed, Jan 29, 2014 at 2:00 PM, Erik Arvidsson erik.arvids...@gmail.com wrote: `export default 1` works. https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports ExportDeclaration : export default AssignmentExpression ; I think that just exports the value 1 with the name

Re: restrictions on module import export names

2014-01-29 Thread Calvin Metcalf
So the following are equivalent? ```js export default foo(); export let default = foo(); ``` On Jan 29, 2014 5:19 PM, Jason Orendorff jason.orendo...@gmail.com wrote: On Wed, Jan 29, 2014 at 2:00 PM, Erik Arvidsson erik.arvids...@gmail.com wrote: `export default 1` works.

RE: restrictions on module import export names

2014-01-29 Thread Domenic Denicola
You cannot have a declaration with default as the IdentifierName, since that is a reserved word. So `export let default = foo();` is not possible. From: es-discuss es-discuss-boun...@mozilla.org on behalf of Calvin Metcalf calvin.metc...@gmail.com Sent:

RE: restrictions on module import export names

2014-01-29 Thread Calvin Metcalf
*would be equivalent of it was allowed On Jan 29, 2014 6:30 PM, Domenic Denicola dome...@domenicdenicola.com wrote: You cannot have a declaration with default as the IdentifierName, since that is a reserved word. So `export let default = foo();` is not possible.

Re: restrictions on module import export names

2014-01-29 Thread Jason Orendorff
On Wed, Jan 29, 2014 at 3:39 PM, Calvin Metcalf calvin.metc...@gmail.com wrote: *would be equivalent of it was allowed [...] So the following are equivalent? ```js export default foo(); export let default = foo(); ``` Yes. -j ___ es-discuss

Re: restrictions on module import export names

2014-01-29 Thread Calvin Metcalf
ok so would this be accurate https://gist.github.com/calvinmetcalf/8701624 ? the syntax does make it impossible to write something equivalent to ```js let app = module.exports = require('express')(); ``` On Wed, Jan 29, 2014 at 6:40 PM, Jason Orendorff jason.orendo...@gmail.comwrote: On Wed,

RE: restrictions on module import export names

2014-01-29 Thread Domenic Denicola
I would really encourage you to read the spec grammar. ```js export foo(); ``` This is not allowed by the grammar; there is no form `export expression` ```js export default let a = [thing1, thing2]; ``` This is not allowed by the grammar; `let a = [thing1, thing2]` is not an

Re: restrictions on module import export names

2014-01-29 Thread Kevin Smith
```js let app = module.exports = require('express')(); ``` Not impossible. Possibly: import express from express; let app = express(); export { app as default }; I think you're attempting to optimize edge cases. Also, I agree with Domenic. Read the grammar for the current

restrictions on let declarations

2014-01-29 Thread John Lenz
I have some old notes that says that let can't be used in some context where a var could like: if (a) let x = 2; In my perusal of the spec I don't see that this is the case now. Can someone confirm that for me? ___ es-discuss mailing list

Re: restrictions on let declarations

2014-01-29 Thread Erik Arvidsson
It falls out of the grammar. IfStatement can only contain Statement which does not include Declaration without going through a BlockStatement. On Wed, Jan 29, 2014 at 9:57 PM, John Lenz concavel...@gmail.com wrote: I have some old notes that says that let can't be used in some context where