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

implementation-dependent round two

jdalton opened this issue Β· comments

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] }"

?

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.