Standard modules - concept or concrete?

Andreas Rossberg rossberg at google.com
Thu Jun 20 07:04:07 PDT 2013


On 20 June 2013 15:55, Kevin Smith <zenparsing at gmail.com> wrote:
> I would think the advantage of running compile-time checks against the
> global object is that it can catch errors that we currently use linters for:
>
>     // OOPS - forgot this line!
>     // import { x } from "foo";
>
>     function someRareCase() {
>         x(); // Reference error?
>     }
>
> That's useful, but it comes at the price of treating the global object as if
> it were a static thing, and not dynamic.  From my point of view, though, a
> dynamic global object is just how it goes with Javascript.  I think this
> kind of static checking should be left to linters, unless we are adopting a
> policy of actively discouraging dynamism for the global object.

This actually is the sort of thing that can be difficult to check for
off-line linters, because the use of global variables may depend on
some staged dynamic configuration that a linter cannot easily see,
verify, or assume.

/Andreas


More information about the es-discuss mailing list