Closed gibson042 closed 4 years ago
There is precedent for this and similar changes elsewhere on the Web Platform, e.g. when addEventListener
started supporting an options bag (instead of just a boolean) as the third argument. I think it’s perfectly fine to make such a change.
In fact, I’d be opposed to exposing a brand new static method just for this.
The committee seemed most comfortable with adding arguments to existing callback invocation.
No objections today either; I'm considering this resolved.
This proposal currently suggests invoking
JSON.parse
reviver functions with additional arguments, but @erights noted that he cannot remember any spec change that added arguments to either built-in function or a callback invoked by a built-in function. The specification itself has nothing to say on this issue; a note recommending that implementations do not add custom parameters to built-in functions is the closest I could find:If the committee is uncomfortable with providing new arguments to
JSON.parse
reviver functions, then we would need a shift to something likeJSON.parseWithSource(source, reviver)
orJSON.parseWithSource(source, options)
.