PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Destructuring

Destructuring

Destructuring is a language feature.

A shorthand assignment method to extract fields from a composite structure.

Languages with Destructuring include JavaScript, Reason, Coconut

Example from JavaScript:

const o = {p: 42, q: true}; const {p, q} = o;

Example from Reason:

type person = {name: string, age: int}; let somePerson = {name: "Guy", age: 30}; let {name, age} = somePerson;

Example from Coconut:

{"list": [0] + rest} = {"list": [0, 1, 2, 3]}

Article source

PLDB - Build the next great programming language 路 v2022 Docs Acknowledgements Email GitHub