Live data from Hacker News

Regarding JavaScript trailing commas

dontkry.com

1–10 of 48 posts

Re: Regarding JavaScript trailing commas

#2
Controversies like the "trailing comma" strike me as evidence that JavaScript has superfluous syntax. The reason it even uses commas the way it does is that it started life as a lisp with (manager-mandated) Java-like syntax.

I happen to agree with the position that syntax that can be made implicit should be. CoffeeScript has done a good job of this. LiveScript has done an even better one. What are the arguments against using a syntactically cleaner language that compiles down to the exact same features?

Re: Regarding JavaScript trailing commas

#3

Controversies like the "trailing comma" strike me as evidence that JavaScript has superfluous syntax. The reason it even uses commas the way it does is that it started life as a lisp with (manager-mandated) Java-like syntax. I happen to agree with the position that syntax that can be made implicit should be. CoffeeScript has done a good job of this. LiveScript has done an even better one. What are the arguments again…

> Is there a good reason not to use a syntactically cleaner language ...

I find Coffeescript hard to read. Especially when dealing with nested callbacks (e.x.: when you have to nest, such as with Jasmine `describe` and `it` blocks for testing).

Here's an interesting thread on the "cons" of using Coffeescript: https://news.ycombinator.com/item?id=6527316

Re: Regarding JavaScript trailing commas

#5

Controversies like the "trailing comma" strike me as evidence that JavaScript has superfluous syntax. The reason it even uses commas the way it does is that it started life as a lisp with (manager-mandated) Java-like syntax. I happen to agree with the position that syntax that can be made implicit should be. CoffeeScript has done a good job of this. LiveScript has done an even better one. What are the arguments again…

> Is there a good reason not to use a syntactically cleaner language ... I find Coffeescript hard to read. Especially when dealing with nested callbacks (e.x.: when you have to nest, such as with Jasmine `describe` and `it` blocks for testing). Here's an interesting thread on the "cons" of using Coffeescript: https://news.ycombinator.com/item?id=6527316

Fair enough. Maybe CoffeeScript specifically isn't the answer. But the general idea of compiling neater languages into JavaScript strikes me as a better long-term solution than settling for its current syntactical warts, which are entirely historical accidents.

I do like ES6!

Re: Regarding JavaScript trailing commas

#7

Earlier quoted context omitted.

> Is there a good reason not to use a syntactically cleaner language ... I find Coffeescript hard to read. Especially when dealing with nested callbacks (e.x.: when you have to nest, such as with Jasmine `describe` and `it` blocks for testing). Here's an interesting thread on the "cons" of using Coffeescript: https://news.ycombinator.com/item?id=6527316

Fair enough. Maybe CoffeeScript specifically isn't the answer. But the general idea of compiling neater languages into JavaScript strikes me as a better long-term solution than settling for its current syntactical warts, which are entirely historical accidents. I do like ES6!

I agree. Language features such as async/await (ES7) are exciting.

Re: Regarding JavaScript trailing commas

#8
post #4

I'm a Python programmer. In Python, trailing comma are idiomatic, so I welcome this. Perhaps I'm just a lazy bastard, but it makes cut & paste a lot easier.

Same with PHP.

I'd love to start using trailing commas in JS, but I've definitely had syntax error problems and unparsable JSON from them existing in recent memory.

Re: Regarding JavaScript trailing commas

#10
post #8
post #4

I'm a Python programmer. In Python, trailing comma are idiomatic, so I welcome this. Perhaps I'm just a lazy bastard, but it makes cut & paste a lot easier.

Same with PHP. I'd love to start using trailing commas in JS, but I've definitely had syntax error problems and unparsable JSON from them existing in recent memory.

This might be happening if you haven't updated your JS tools (although JSON is a different beast altogether). Look into fixing it, you'll be having way more fun once you've done so.
Post reply on HN