tc39 / Function-prototype-toString-revision

:fishing_pole_and_fish: ECMA-262 proposal to update Function.prototype.toString

Home Page:https://tc39.github.io/Function-prototype-toString-revision

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gotcha about Set.prototype.delete.toString()

claudepache opened this issue · comments

Currently, implementations have generally Set.prototype.delete.toString() evaluating to something resembling to "function delete() { [native code] }"... which does not conform to this proposal, since delete is not a BindingIdentifier. So they have to switch to something less natural.

This is not necessarily a bug, but it is nevertheless surprising.

However, since the evaluation of "function foo() { [native code] }" produces a SyntaxError anyway, I think it makes sense to permit foo to be an IdentifierName instead of just a BindingIdentifier (i.e., to include also reserved words).

+1 to this, for at least the NativeCode cases.