new function syntax and poison pill methods

Rick Waldron waldron.rick at gmail.com
Fri Oct 26 11:25:43 PDT 2012


Inline...

On Fri, Oct 26, 2012 at 1:37 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

> 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.
>

The least desirable as far as "paving an ideal path forward", but likely
the most realistically desirable if the goal maintain expectations.


> 2)  All new function forms always get poison pills, even if they aren't
> strict.
>

This could be seen as "less to think about" w/r to just new function forms,
or "more to think about" when side-by-side with existing function forms.
I'm willing to champion this as progress and a future with "less to think
about".


> 3)  They never get poison pills because new implementor would be silly
> enough to associate they legacy features with new syntax.
>

Of course, this is the "ideal world" option, right? Less to implement, less
to be concerned with on the whole. On the other hand, I'd be worried that
leaving it unspecified would inevitably result in mismatched
implementations.


#2 and #3

Rick






>
> 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.
>
> Allen
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121026/746f6782/attachment.html>


More information about the es-discuss mailing list