Description
Add a spread operator (...) to the mq language for expanding arrays and dicts inline within array literals and dict literals.
Proposed syntax
Array spread
let a = [1, 2, 3];
let b = [4, 5, 6];
let c = [...a, ...b]; # [1, 2, 3, 4, 5, 6]
let d = [0, ...a, 99]; # [0, 1, 2, 3, 99]
Dict spread
let base = {x: 1, y: 2};
let merged = {...base, y: 99, z: 3}; # {x: 1, y: 99, z: 3}
Later keys override earlier ones when the same key appears more than once.
Description
Add a spread operator (
...) to the mq language for expanding arrays and dicts inline within array literals and dict literals.Proposed syntax
Array spread
Dict spread
Later keys override earlier ones when the same key appears more than once.