SQL error: near ")": syntax error

mattk on 2008-01-28T06:47:05

The Anti-Wall Illuminati like to disseminate a myth that says that when you cut your teeth on Perl, it breaks your mind permanently, in many nefarious ways, for any other language.

I'm not sure whether it's just about thinking in the wrong language, but there's one syntactical landmine I always stomp on: a lax attitude towards commas after the final element in a list. Ruby seems to be the only other language that lets it slide - Javascript may or may not, depending on the browser and whether the interpreter is having a bad day already.

Now I've decided this is an open letter to the people writing parsers for lists: If I give you commas you'll take them. Oh yes.


even python

rjbs on 2008-01-28T13:34:25

Even *Python* lets you have a trailing comma. For shame, Javascript, for shame.

Re:even python

duff on 2008-01-28T15:23:24

I think all of the modern javascript parsers can handle the trailing comma. It's the older ones (say, the one that IE 6 uses) that freak out.

Re:even python

phaylon on 2008-01-28T19:23:36

At least a few months ago there were some JSON modules on CPAN who did this too.

Re:even python

ChrisDolan on 2008-01-29T06:27:49

Even *Java* lets you have trailing commas in curly-delimited array initializers.

Re:even python

rjbs on 2008-01-29T12:50:45

Is that a surprise? I mean, wouldn't Java always be predisposed to allow you perform extra typing?

Just be thankful they don't *require* trailing commas.