Modules and eval

David Herman dherman at mozilla.com
Mon May 2 14:11:27 PDT 2011


That sounds like a grammar bug -- no time to debug at the moment but I'll address. A Program should be able to import but not export.

Dave

On May 2, 2011, at 12:50 PM, Erik Arvidsson wrote:

> http://wiki.ecmascript.org/doku.php?id=harmony:modules
> http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders
> 
> The loader says that eval and evalLoad uses Program which allows
> export and import. What does it mean to import and export something
> within eval code?
> 
> Take this small program. Does this fail or not?
> 
> module m {
>  export function addExport(name) {
>    eval('export var ' + name + ' = ' name)
>  }
>  var x = 42
> }
> 
> m.addExport('x')
> assert(m.x === 42)
> 
> 
> -- 
> erik



More information about the es-discuss mailing list