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

implementation-dependent round two #23

Closed jdalton closed 7 years ago

jdalton commented 7 years ago

I dig the revisions to this proposal 👍!

If Type(func) is Object and IsCallable(func) is true, then return an implementation-dependent String source code representation of func. The representation must have the syntax of a NativeFunction. Throw a TypeError exception.

I see that it states implementation-dependent string, but then also specifies

NativeFunction: function IdentifierNameopt (FormalParameters){ [nativecode] }

Is the wiggle room the whitespace around it? For example Chakra and V8 produce:

"function push() { [native code] }"

Where SpiderMonkey and JSC produce:

"function push() {\n    [native code]\n}"

Have you gotten pushback for say standardizing on:

"function push() { [native code] }"

?

michaelficarra commented 7 years ago

Yes, the wiggle room is in the whitespace and comments. Standardising the toString output for values which are currently only restricted by the NativeFunction grammar was proposed in #21. Closing as duplicate.