
Unambiguous JavaScript Grammar - ingve
https://github.com/bmeck/UnambiguousJavaScriptGrammar/blob/master/README.md
======
olliej
Author seems to be mostly concerned by code loaded as a module being treated
as strict 100% of the time.

Literally every difference that they list is strict mode (and the usual
misunderstanding of |this|)

~~~
simplify
What usual misunderstanding of |this| are you referring to?

~~~
olliej
People keep trying to apply lexical scope for |this| when it is always the
left hand of the function refernece expression, e.g.

Lhs.foo()

Lhs[foo]()

And

Foo() // where lhs is implied to be the scope object defining Foo

The last one seems to be what makes everyone super confused, but it is
logically:

GetScopeWith("foo").foo()

Strict mode changes /one/ thing about|this|: whether the value of |this|
undergoes object coercion

------
wereHamster

        function foo(value) {
          value = value || '';
          var args = [].slice.call(arguments);
          args.unshift(this);
          return args;
        }
        foo(null);
        export {};
    

If your module does nothing but side-effects during _load_ time, screw you.

~~~
jdd
That's generally and edge case and totally supported under the proposal by
being explicit about with respect to `export`.

I think being explicit about the intent of your code is a good thing after
all.

------
nv-vn
Why can't this be done as a module declaration? I.e. a file would be prefaced
with `module Main;` to declare that it's a module and give it a name.

~~~
aeosynth
That requires modification to every file using ES modules, and new syntax. The
proposed solution only requires modifying files which do not have an import or
export statement, and does not need new syntax.

------
citrusx
Who else thinks that this whole mess around trying to implement ES modules
demonstrates that they were a bad idea to begin with?

------
ryanlm
Where is the BNF?

~~~
coldtea
There's no BNF, this is not a language spec or full grammar, it just describes
an addition to the existing grammar to denote a module.

------
gcb0
yeah, i just use it for scripting browsers, which don't support most of that
shenanigans. for real work i use languages that are not a week old. I have no
idea what exactly is being discussed there, other then it requires a syntax
hack with `exports {}` to break the new standard.

~~~
Wintamute
> I have no idea what exactly is being discussed there

Criticizes it anyway .. something something JS is bad. Thanks for your high
level input.

