tc39 / tc39/proposal-json-parseimmutable

Can we get frozen-by-default by refactoring the proposal into a reviver factory?

Open
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
48
Forks
4
Avg merge
1d 1m
Merged PRs (30d)
5

Description

(This is following up on a question I briefly raised at plenary last week)

With the proposal framed as an options bag on JSON.parse, we're constrained to keeping the same default behavior. If instead we pivot to defining a standard reviver factory for getting revivers to pass to JSON.parse, then we could potentially update the defaults since you're opting into using it by calling the function.

For example,

JSON.parse(str, JSON.frozen())

It's not quite as simple as {}, and is probably a non-starter because preventing communication channels will require returning a brand new function every time, making it infeasible from a performance standpoint, but I figured I'd at least follow up here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposal's JSON.parse options-bag approach and the suggested JSON.frozen() reviver-factory entry point. Evaluate whether opting into a factory permits changed defaults and whether a new function per call is acceptable; done means reaching a resolved design direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.