Languages Patterns Calendar About Lists Join



Destructuring is a design pattern. A shorthand assignment method to extract fields from a composite structure.

Languages with Destructuring include coconut, javascript, reason

Example from coconut:

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

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;

Article source

PLDB - Build the next great programming language. v5.0.0 - Email ยท Github