Re: restrictions on module import export names

2014-01-30 Thread Calvin Metcalf
forgot to hit replay all On Thu, Jan 30, 2014 at 10:25 AM, Kevin Smith wrote: > [Did you mean to reply all?] > > ```js >> var projs = [ >> import "./projections/merc", >> import "./projections/longlat" >> ]; >> ``` >> > > That idea was last discussed on the list two or three years ago.

Re: restrictions on module import export names

2014-01-30 Thread Kevin Smith
> > var projs = [ > require('./projections/merc'), > > require('./projections/longlat') > ]; > > With ES6 modules, you might do something like this: import merc from "./projections/merc"; import longlat from "./projections/longlat"; var projs = [merc, longlat]; Or if you're impor

Re: restrictions on module import export names

2014-01-30 Thread Calvin Metcalf
sorry guys, was getting confused on VariableStatement vs AssignmentExpression, gist is updated with correct examples, I guess it seems somewhat overly complicated having 4 different ways to export things each with their own arbitrary restrictions which leads to weirdness, e.g. if you want to export

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 cu

RE: restrictions on module import export names

2014-01-29 Thread Domenic Denicola
21:46 To: Jason Orendorff Cc: Domenic Denicola; Erik Arvidsson; EcmaScript Subject: Re: restrictions on module import export names 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 = mod

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 wrote: > On Wed, Jan 29, 2014 at 3:39 PM,

Re: restrictions on module import export names

2014-01-29 Thread Jason Orendorff
On Wed, Jan 29, 2014 at 3:39 PM, Calvin Metcalf 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 mailing list

RE: restrictions on module import export names

2014-01-29 Thread Calvin Metcalf
- > *From:* es-discuss on behalf of Calvin > Metcalf > *Sent:* Wednesday, January 29, 2014 18:25 > *To:* Jason Orendorff > *Cc:* EcmaScript; Erik Arvidsson > *Subject:* Re: restrictions on module import export names > > > So the following are e

RE: restrictions on module import export names

2014-01-29 Thread Domenic Denicola
endorff Cc: EcmaScript; Erik Arvidsson Subject: Re: restrictions on module import export names So the following are equivalent? ```js export default foo(); export let default = foo(); ``` On Jan 29, 2014 5:19 PM, "Jason Orendorff" mailto:jason.orendo...@gmail.com>> wrote: On We

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" wrote: > On Wed, Jan 29, 2014 at 2:00 PM, Erik Arvidsson > wrote: > > `export default 1` works. > > > > https://people.mozilla.org/~jorendorff/es6-draft.html#s

Re: restrictions on module import export names

2014-01-29 Thread Jason Orendorff
On Wed, Jan 29, 2014 at 2:00 PM, Erik Arvidsson 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 "default". -j ___

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 wrote: > related, is it possible to export anonymous objects? > > from looking at the s

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 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

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 wrote: > // a.js >> >> var foo = 1; >> export foo as 'a.b.c'; >> >> // b.js >> >> import

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 https: