reasonml / reasonml/reason

Destructuring objects

Open
#1,932 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

KIND: FEATURE REQUEST Parser
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Records have some nice destructuring:

type foo = {bar: string, baz: int};
let z = {bar:"blah", baz:123};
let {bar, baz} = z;
let f = ({bar, baz}) => bar;

Would be nice to have the same for JS objects too:

type foo = {. "bar": string, "baz": int};
let z = {"bar":"blah", "baz":123};
let {bar, baz} = z;
let f = ({bar, baz}) => bar;

Contributor guide

No contributing guide indexed for this repository

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

No files, tests, or entry points are named in the issue. Start by locating the compiler areas that parse and type-check object destructuring, then compare their handling of records with JavaScript objects. Done means the shown JavaScript-object examples compile and behave as intended, with coverage for the new syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, ocaml
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.