tc39 / Function-prototype-toString-revision

:fishing_pole_and_fish: ECMA-262 proposal to update Function.prototype.toString
https://tc39.github.io/Function-prototype-toString-revision
26 stars 10 forks source link

%ThrowTypeError% name (again) #28

Closed anba closed 6 years ago

anba commented 6 years ago

Follow-up from #14

https://github.com/tc39/Function-prototype-toString-revision/issues/14#issuecomment-250266610

I think we should just make it an invariant that all well-known intrinsics that are functions be given names.

Currently well-known intrinsics are extended when external specifications like to have an entry for a built-in function (https://github.com/tc39/ecma262/pull/1105). That means when an external spec likes to have a reference to a currently anonymous built-in, the built-in needs to be named before it can be added as a well-known intrinsic. And I'm not sure I like to have this kind of dependency in the spec. It feels a bit obscure. Also when a well-known intrinsic entry is no longer needed, would it be possible to change the function back to be anonymous or do we need to keep the name for compatibility reasons?

This may all change with https://github.com/tc39/ecma262/issues/1049 which ditches the concept of anonymous functions, but until we have a decision for that issue, I'd say @claudepache 's proposal at https://github.com/tc39/Function-prototype-toString-revision/issues/14#issuecomment-236314709 seems to be the better choice here.