Nice 9-minute video from Matt Pocock (from about a year ago) introducing composites. The problem of not being able to compare objects definitely feels worth solving. Or, more accurately, fixing the issue where when compare two objects that look exactly the same, it’s still false. And that using them as keys doesn’t work. Sounds like Records & Tuples were close, but the performance downsides were too strong. Composites are more likely to happen.
const pos1 = Composite({ x: 1, y: 4 });
const pos2 = Composite({ x: 1, y: 4 });
Composite.equal(pos1, pos2); // trueCode language: JavaScript (javascript)
Still true if you swap the order of the keys! Looks good to me. I don’t think it’s particularly close to making it into the language, but I see there is still discussion and research going on.
