treated as a module if ...

Erik Arvidsson erik.arvidsson at gmail.com
Sun Jul 5 15:41:18 UTC 2015


No. This all comes down how the file is evaluated and that is determined
whether the file is treated as Script [1] or Module [2]. Modules are always
strict and Script is sloppy unless it starts with a use strict directive.
Traditionally all source files have been treated as Script but in ES'15 we
provide another hook for the embedder to invoke which allows the source
file to be treated as a Module [3]. The idea is that the module loader spec
[4] will use this hook.

[1] http://ecma-international.org/ecma-262/6.0/#sec-scripts
[2] http://ecma-international.org/ecma-262/6.0/#sec-modules
[3]
http://ecma-international.org/ecma-262/6.0/#sec-toplevelmoduleevaluationjob
[4] http://whatwg.github.io/loader/

HTH,

Erik


On Sun, Jul 5, 2015 at 9:38 AM Mark Volkmann <r.mark.volkmann at gmail.com>
wrote:

> Thanks for the quick reply! Does this mean that a file that contains
> imports, but no exports, is not by default evaluated in strict mode?
>
> On Sun, Jul 5, 2015 at 8:27 AM, Erik Arvidsson <erik.arvidsson at gmail.com>
> wrote:
>
>> d. If a source file is imported it is parsed using the Module production.
>>
>> On Sun, Jul 5, 2015, 09:03 Mark Volkmann <r.mark.volkmann at gmail.com>
>> wrote:
>>
>>> Fill in the blank.
>>> In ES 2015, a JS source file is treated as a module if _____.
>>> a. it exports anything
>>> b. it imports anything
>>> c. both a and b
>>> d. something else
>>>
>>> ---
>>> R. Mark Volkmann
>>> Object Computing, Inc.
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150705/436c3614/attachment.html>


More information about the es-discuss mailing list