new function syntax and poison pill methods

Allen Wirfs-Brock allen at
Fri Oct 26 10:37:14 PDT 2012

ES5 added "poison pill" properties to the strict mode function objects that were intended to prevent implementors from supporting the non-standard legacy "caller" and "arguments" properties on such objects.

In ES6 we have several new syntactic forms for defining functions: arrow functions, concise methods, generators.  What should be do WRT the position pill properties for functions defined using such new syntax.  Possibilities:

1)  Same as ES5 function definitions.  If strict they get the poison pills , if non-strict they don't.
2)  All new function forms always get poison pills, even if they aren't strict.
3)  They never get poison pills because new implementor would be silly enough to associate they legacy features with new syntax.

Options 1&2 would essentially collapse to "always" if new function definition syntactic forms always produced strict mode code.  However, I believe, the current plan of record is that the new forms have the same strict mode opt-in rules as ES5 uses for function definitions.


More information about the es-discuss mailing list