3 ms·
What this means, in CoffeeScript, is that std exposes int and vec, which I am bringing into this namespace, and possibly other things which I am not. If I want
by yesbabyyes 15y ago
What this means, in CoffeeScript, is that std exposes int and vec, which I am bringing into this namespace, and possibly other things which I am not. If I want to use all of std, I would have to write
std = require('std')
and access std.int, std.vec and so on.
- philh 15y agoThanks 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