5 ms·
This is nice. There are too many gotchas to remember in JavaScript; better to let a liberal compiler translate something nice into the "machine code" that work
by jrockway 17y ago
This is nice. There are too many gotchas to remember in JavaScript; better to let a liberal compiler translate something nice into the "machine code" that works in all browsers.
(Personally, I always write:
something = {
foo: "bar",
bar: "baz",
}
which works in Firefox, but not IE. A compiler would not be upset when it omits that extra trailing comma. Of course, you can always write:
something = { foo: "bar"
, bar: "baz"
}
But let's face it, that is only not ugly in Haskell.)
- btilly 17y agoIf the second form works and avoids bugs, can't you train your eyes to accept it? That's what I did in SQL a few years ago, and I can't count how many times it has helped me since.
- jashkenas 17y agoWhich is why CoffeeScript lets you leave commas out of multiline object and array literals (for those that didn't see catch it in there): something: { foo: "bar" bar: "baz" }