Imports and eval

Allen Wirfs-Brock allen at
Mon Jun 2 09:45:43 PDT 2014

On Jun 2, 2014, at 6:33 PM, Juan Ignacio Dopazo <jdopazo at> wrote:

> Import/export declarations are designed to be static. However, eval() seems to break this invariant:
> eval('import ' + foo + ' from ' + bar);
> Is this valid ES6 code? Should it be valid?

No and no.  In ES6 eval parses the using the Script grammar goal symbol.  Imports are not allowed in scripts, but only in modules.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list