John Lenz (2014-01-24T17:47:44.000Z)
On Fri, Jan 24, 2014 at 9:32 AM, David Bruant <bruant.d at gmail.com> wrote:

>  Le 24/01/2014 18:26, John Lenz a écrit :
>
>
>
>>  REPL is a dilemma: if you parse as module, then obtaining the last
>> expression value is not simple. if you parse as a script, then common
>> cut/paste fails on export/import statements.
>>
>
>  My basic question remains.  As a tool owner how do I know if what I'm
> looking at is intended to be a Module or a Script?
>
> How do you know if some code is intended for the browser or Node?
> How do you know some code is intended to be used in a WebWorker and not in
> the main thread?
>

These don't affect how the code is parsed or the behavior of the language
itself.


>  How do you know the code won't be concatenated a "use strict" when
> someone else uses it?
>

This is an assembly issue and doesn't void intent.    If it is true you
won't be able "import" from a script, it is very reasonable to want to warn
about this.


>
> The code itself lacks the context in which it's being loaded (hence very
> defensive patterns like UMD (Universal Module Definition)).
> If you want to be exhaustive, you'll have to make an assumption or make
> your tool smarter about the context.
>

I want it to be "smarter" about the context, but smarter means knowing
without being told.  Having a different set of reserved words (between
"loose" and "strict" mode) means this is a parser issue.


>
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140124/d3674adc/attachment.html>
domenic at domenicdenicola.com (2014-01-31T21:15:02.529Z)
On Fri, Jan 24, 2014 at 9:32 AM, David Bruant <bruant.d at gmail.com> wrote:


> How do you know if some code is intended for the browser or Node?
> How do you know some code is intended to be used in a WebWorker and not in
> the main thread?

These don't affect how the code is parsed or the behavior of the language
itself.


>  How do you know the code won't be concatenated a "use strict" when
> someone else uses it?

This is an assembly issue and doesn't void intent.    If it is true you
won't be able "import" from a script, it is very reasonable to want to warn
about this.


> The code itself lacks the context in which it's being loaded (hence very
> defensive patterns like UMD (Universal Module Definition)).
> If you want to be exhaustive, you'll have to make an assumption or make
> your tool smarter about the context.

I want it to be "smarter" about the context, but smarter means knowing
without being told.  Having a different set of reserved words (between
"loose" and "strict" mode) means this is a parser issue.