04:07
<rbuckton>

I was thinking about the old .{ operator recently, in terms of how it could potentially be used for extraction and injection as an RCU (read/copy, update) mechanism in the shared structs proposal (or possibly as a follow on). I started tinkering with various ideas for the syntax, and while I have something fairly consistent in mind, I came across a wart related to spread and rest assignments in destructuring syntax:

a = { ...b }; // spread properties of 'b' 
({ ...x } = y); // take the rest of the properties and put them in 'x'

One of the ideas I had for .{ was doing named spread/rest in extraction/injection, in which you would want extraction and injection to be mirrored, and you could either use spread or rest in either operator:

b = a.{ x, ...y }; // pick 'x' as 'x', and pick up the rest as 'y'
b = a.{ x, y... }; // pick 'x' as 'x', and spread out 'y'
a.{ x, ...y } = b; // assign 'x' from 'x', and take up the rest as 'y'
a.{ x, y... } = b; // assign 'x' from 'x', and spread out 'y'

Which makes me wonder if spread should have been written as foo...