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

fixes #9: enforce names of well-known intrinsic function objects #10

Closed michaelficarra closed 8 years ago

michaelficarra commented 8 years ago

Fixes #9. @gibson042 let me know what you think.

Regardless, I'll wait for reviewer/editor approval of this PR before merging it since it's not important to me.

bterlson commented 8 years ago

I think this is a good idea personally. Since implementations do this already it would be good to require it. I wouldn't be surprised if this is actually a web-reality requirement.

michaelficarra commented 8 years ago

What should be done about %GeneratorFunction%, %TypedArray%, and other intrinsics that are not exposed as globals? Should we just add a Global Name field for them? It's not referenced anywhere else.

gibson042 commented 8 years ago

What should be done about %GeneratorFunction%, %TypedArray%, and other intrinsics that are not exposed as globals? Should we just add a Global Name field for them? It's not referenced anywhere else.

I would support that. It's also consistent with the majority (Edge being the odd one out): https://jsfiddle.net/d0521eko/

bterlson commented 8 years ago

I would also support mandating some actual string for these built-ins. However I don't think we can call it global name as that would be confusing as it's not reachable from global like the others. Throwing this out there, but what about another column that is "friendly name" or something and the spec text uses either the global name or else the friendly name (and assert that one of these will exist)?

michaelficarra commented 8 years ago

Then I think this should probably happen as a separate effort. @bterlson Do you think it would have to go through the full proposal process or could it just be submitted as a PR to tc39/ecma262 later?

bterlson commented 8 years ago

@michaelficarra I'm not sure it should be a separate process. These friendly names only need to exist for F.p.toString to do something with them, so seems best to include them in this proposal?