3 ms·
Thanks for clarifying. I think I like rust version better: when I see an '=' sign, I assume that the RHS returns something which is assigned to the LHS, and so
by philh 15y ago
Thanks for clarifying.
I think I like rust version better: when I see an '=' sign, I assume that the RHS returns something which is assigned to the LHS, and something doesn't depend on the LHS. Coffeescript violates that, and it feels much more like 'special syntax'. But without knowing either language, I won't go further than "this seems weird".
- moomin 15y agoActually, the genius of the coffeescript version is that it's just a use case of the general destructuring syntax. So { x, y } = { x : 3, y : 5, z : 3 } is perfectly valid as well. Once you get the hang of coffeescript's destructuring, it's insanely powerful.
- yesbabyyes 15y agoI don't view it as that the something returned depends on the left hand side, rather that the left hand side picks what it wants out of that. It's also useful in arrays: [x, y] = [1, 2] With splats: [first, second, rest...] = contenders