Earlier quoted context omitted.
Well, that opens up a whole new can of syntax worms... But yeah, all of this stuff just makes me more convinced that Lisp syntax is the best ever.
Lisp uses comas in macro evaluation, but not lists and dictionaries. Then you have reader macros. Lisp syntax can be arbitrarily complex.
Regarding JavaScript trailing commas
41–48 of 48 posts
Re: Regarding JavaScript trailing commas
#42In my opinion it is just a matter of personal taste, if I move some code without trailing commas I make sure that the commas are in the right place. This actually can be seen as an advantage given that blind copy and paste is the source of all evils, so a syntax error will force you to reconsider what you have just done blindly. All in all I don't see a problem in using either styles, it's only one character differen…
In a compiled language you catch this because it's a syntax error. In JavaScript, it might be missed through every code review (because it's subtle) and and then break on release to you production system.
So it's not just style, it can help reduce bugs.
Re: Regarding JavaScript trailing commas
#43Earlier quoted context omitted.
Well, that opens up a whole new can of syntax worms... But yeah, all of this stuff just makes me more convinced that Lisp syntax is the best ever.
Lisp uses comas in macro evaluation, but not lists and dictionaries. Then you have reader macros. Lisp syntax can be arbitrarily complex.
In the Scheme backquote (dubbed quasiquote), the spec says that the read syntax ,X produces (unquote X). You can omit the comma, and then you just have X.
This is totally different from a comma which just punctuates syntax.
Re: Regarding JavaScript trailing commas
#44Re: Regarding JavaScript trailing commas
#45Earlier quoted context omitted.
Well, that opens up a whole new can of syntax worms... But yeah, all of this stuff just makes me more convinced that Lisp syntax is the best ever.
Lisp uses comas in macro evaluation, but not lists and dictionaries. Then you have reader macros. Lisp syntax can be arbitrarily complex.
For example one can write a vector of three elements, where the second element is computed:
`#(1 ,(first *features*) b)
Backquote list forms happen to be used in some macros as a kind of template forms. Macros can be defined without them and backquote forms are also used elsewhere in Lisp.Re: Regarding JavaScript trailing commas
#46I've actually come to like a weird style popular in the Haskell world, leading commas : { one = 1 , two = 2 , three = 3 } It's weird, but it's actually pretty convenient. I think it has all the same properties the article argues for, but I don't want to figure it out for sure at the moment.
No way. What you if had to cut and paste the first item?
It is marginally more difficult than leaving in trailing commas, but way better than adding missing unaligned commas at EOL.
Re: Regarding JavaScript trailing commas
#47Earlier quoted context omitted.
Lisp uses comas in macro evaluation, but not lists and dictionaries. Then you have reader macros. Lisp syntax can be arbitrarily complex.
macro and comma is fully unrelated. The comma in backquote expressions is not even limited to lists. Commas are used in backquote forms to force evaluation. For example one can write a vector of three elements, where the second element is computed: `#(1 ,(first *features*) b) Backquote list forms happen to be used in some macros as a kind of template forms. Macros can be defined without them and backquote forms are a…
"Macros took a major step forward with Lisp-Machine Lisp, which consolidated the various macro-defining techniques into two standardized features that were adopted throughout the MacLisp community and eventually into Common Lisp. The macro defining operator DEFMACRO provided list-structure destructuring to arbitrary depth; the backquote feature provided a convenient and concise pseudo-quoting facility. [ ... ] Backquote and DEFMACRO made a big difference. This leap in expressive power, made available in a standard form, began a new surge of language extension [...]" [3.3]
Re: Regarding JavaScript trailing commas
#48Earlier quoted context omitted.
macro and comma is fully unrelated. The comma in backquote expressions is not even limited to lists. Commas are used in backquote forms to force evaluation. For example one can write a vector of three elements, where the second element is computed: `#(1 ,(first *features*) b) Backquote list forms happen to be used in some macros as a kind of template forms. Macros can be defined without them and backquote forms are a…
They are not "fully unrelated". The backquote syntax for constructing lists was primarily designed for macro programming. See the paper Evolution of Lisp by Guy Steele and Peter Gabriel: "Macros took a major step forward with Lisp-Machine Lisp, which consolidated the various macro-defining techniques into two standardized features that were adopted throughout the MacLisp community and eventually into Common Lisp. The…