what makes a file a module?

2014-10-19 Thread Mark Volkmann
I understand that module code is implicitly in strict mode. In an ES6 environment, what causes a .js file to be treated as a module? Does that happen automatically to all files that export at least one thing? -- R. Mark Volkmann Object Computing, Inc.

Re: what makes a file a module?

2014-10-19 Thread Erik Arvidsson
A file that is imported is treated as a module. That's it. On Oct 19, 2014 1:50 PM, Mark Volkmann r.mark.volkm...@gmail.com wrote: I understand that module code is implicitly in strict mode. In an ES6 environment, what causes a .js file to be treated as a module? Does that happen automatically

Re: what makes a file a module?

2014-10-19 Thread Axel Rauschmayer
It depends on how you access it: if you import the file or load it via `module` then the file is interpreted as a module. On Oct 19, 2014, at 19:50 , Mark Volkmann r.mark.volkm...@gmail.com wrote: I understand that module code is implicitly in strict mode. In an ES6 environment, what

Re: Array.prototype.values is not web compat (even with unscopables)

2014-10-19 Thread Benjamin Gruenbaum
Just as a note - I think that if we learned anything in this regard it's that standards should guide and not dictate. It׳s rather impossible to break reasonable user level code and I don't think it's reasonable to expect developers to be fortune tellers :) (I like the idea though) On Oct

Re: Array.prototype.values is not web compat (even with unscopables)

2014-10-19 Thread Fabrício Matté
@Benjamin Not sure if I understand what you mean. If standards don't dictate, then how are we supposed to expect interoperable implementations? By impossible I suspect you mean something that browser vendors should never do. I understand back-compatibility with the Web is a must for browser

Re: what makes a file a module?

2014-10-19 Thread Rick Waldron
On Sun, Oct 19, 2014 at 1:59 PM, Erik Arvidsson erik.arvids...@gmail.com wrote: A file that is imported is treated as a module. That's it. And you can statically infer that a file is module by reading the source and scanning for `export`, which would also mean it's a module. This wouldn't catch

Re: what makes a file a module?

2014-10-19 Thread Allen Wirfs-Brock
On Oct 19, 2014, at 1:04 PM, Rick Waldron wrote: On Sun, Oct 19, 2014 at 1:59 PM, Erik Arvidsson erik.arvids...@gmail.com wrote: A file that is imported is treated as a module. That's it. And you can statically infer that a file is module by reading the source and scanning for

Re: what makes a file a module?

2014-10-19 Thread Mark Volkmann
On Sun, Oct 19, 2014 at 4:23 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: It is implementation dependent how it is determined whether an individual file will be parsed as a Script or as a Module. This seems problematic because it means I can't assume that strict mode will be inferred.

Re: what makes a file a module?

2014-10-19 Thread Allen Wirfs-Brock
On Oct 19, 2014, at 2:28 PM, Mark Volkmann wrote: On Sun, Oct 19, 2014 at 4:23 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: It is implementation dependent how it is determined whether an individual file will be parsed as a Script or as a Module. This seems problematic because it

Re: what makes a file a module?

2014-10-19 Thread Mark Volkmann
Can we say anything more concrete if we restrict the discussion to modern browsers as opposed to non-browser ES engines? Is it fair to say that in those environments a file will always be treated as a module if it is imported by another file that the browser has loaded? On Sun, Oct 19, 2014 at

Re: what makes a file a module?

2014-10-19 Thread Allen Wirfs-Brock
On Oct 19, 2014, at 5:42 PM, Mark Volkmann wrote: Can we say anything more concrete if we restrict the discussion to modern browsers as opposed to non-browser ES engines? Is it fair to say that in those environments a file will always be treated as a module if it is imported by another

RE: what makes a file a module?

2014-10-19 Thread Domenic Denicola
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Mark Volkmann Can we say anything more concrete if we restrict the discussion to modern browsers as opposed to non-browser ES engines? Is it fair to say that in those environments a file will always be treated as a module

Re: what makes a file a module?

2014-10-19 Thread Mark S. Miller
On Sun, Oct 19, 2014 at 7:48 PM, Domenic Denicola dome...@domenicdenicola.com wrote: From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Mark Volkmann Can we say anything more concrete if we restrict the discussion to modern browsers as opposed to non-browser ES engines?

RE: what makes a file a module?

2014-10-19 Thread Domenic Denicola
From: Mark S. Miller [mailto:erig...@google.com] For all new standard tags, browsers that recognize these tags and browsers that do not must agree on when the element is done. This can't be completely true, as `main` and `template` were introduced recently and definitely don't follow that

Re: what makes a file a module?

2014-10-19 Thread Mark S. Miller
On Sun, Oct 19, 2014 at 8:05 PM, Domenic Denicola dome...@domenicdenicola.com wrote: From: Mark S. Miller [mailto:erig...@google.com] For all new standard tags, browsers that recognize these tags and browsers that do not must agree on when the element is done. This can't be completely

Re: what makes a file a module?

2014-10-19 Thread John Barton
On Sun, Oct 19, 2014 at 2:23 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: It is implementation dependent how it is determined whether an individual file will be parsed as a Script or as a Module. Axel alluded to a possible HTML extension that could be used to distinguish modules from

Re: what makes a file a module?

2014-10-19 Thread Mark Miller
I agree that we should come to consensus on a file extension. The argument that it is out of our jurisdiction only makes sense to me if it is in some other group's jurisdiction. AFAICT, it is not. And consensus is needed, so let's proceed. Suggestions? Is there any reason we should still limit

Re: what makes a file a module?

2014-10-19 Thread Caridy Patino
it is a module if: a) it is imported using imperative form thru a loader (with we are still working out the details) b) it is imported using declarative form (ImportDeclaration) c) future module tag, or script type=module (still to figure). there is an exception for these rules. if you use a