Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

mattk (7945)

mattk
  (email not shown publicly)
http://perlmonks.org/?node_id=424873

Developer for a domain registrar/web host.

Journal of mattk (7945)

Monday January 28, 2008
01:47 AM

SQL error: near ")": syntax error

[ #35497 ]

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Even *Python* lets you have a trailing comma. For shame, Javascript, for shame.
    --
    rjbs
    • 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.
      • At least a few months ago there were some JSON modules on CPAN who did this too.

        --
        Ordinary morality is for ordinary people. -- Aleister Crowley
    • Even *Java* lets you have trailing commas in curly-delimited array initializers [sun.com].
      • 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.
        --
        rjbs