Standard modules?

Sebastian McKenzie sebmck at gmail.com
Mon Jan 20 10:09:36 PST 2014


It seem strangely inconsistent not to make it a global. I've had to access
GeneratorFunction using the aforementioned method when I was writing an
async view engine to dynamically create rendering functions like so:

    var GeneratorFunction = (function *() {}).constructor;
    var functionBody = "";
    // parse view
    return new GeneratorFunction(functionBody);

Accessing it via the constructor seems very sloppy.


On Tue, Jan 21, 2014 at 4:39 AM, Brendan Eich <brendan at mozilla.com> wrote:

> Allen Wirfs-Brock wrote:
>
>> It isn't clear that there much need for a global name for
>> GeneratorFunction.  If you really eed to access it can always get it via:
>>
>>    (function *() {}).constructor
>>
>
> Does this present a hazard for CSP, which provides policy controls
> governing Function?
>
> I agree we shouldn't add a global GeneratorFunction -- not without a
> pressing use-case and evidence that we can get away with adding that global.
>
> /be
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Sebastian McKenzie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140121/574e8ff0/attachment.html>


More information about the es-discuss mailing list