00:28 | <voidhedron> | not really related but I don't think you should be using such unusual syntax like 0, { a, b, c } |
00:30 | <voidhedron> | it will confuse a lot of people and takes away attention from the actual api in discussion, I just spent a hot minute distracted by it to figure out why its there and what its doing instead of looking at anything else on the code |
00:31 | <voidhedron> | actually, I don't even understand what its for, I thought I did, assuming this wasn't valid because of ambiguity or something, but seems like it is? |
00:34 | <Kris Kowal> | { a, b, c} is a block statement and ({ a, b, c }) is a record declaration expression. 0, { a, b, c } is also an equivalent expression that discards the 0 . |
00:35 | <Kris Kowal> | ({ a, b, c } = longExpression()) is pretty hard to scan too. 🤷♂️ |
00:35 | <bakkot> | { x, y } = obj only works in Node's repl, not in an actual JS environment |
00:35 | <bakkot> | you need to write 0, { x, y } = obj or ({x, y} = obj) in a real JS environment, and of those, the former is easier to read IMO |
00:36 | <bakkot> | it's the same sort of thing as the old (0, arg.method)(thing) pattern |
00:37 | <Kris Kowal> | Also, (0, eval)(script) |
00:37 | <Kris Kowal> | (Which protects your scope) |
00:38 | <voidhedron> | Ah I didn't realize the repl's automatic object literal parens wrapping would extend to impacting this too |
10:55 | <Ashley Claymore> | in TypeScript I may or may not have written void 0, { x, y } = to make it happy |