[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thoughts on optional commas
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 4 Mar 2012 19:33:44 +0200
Now that we have had some discussion, let's just look at the original post
again.
> Occasionally I forget commas when I create large nested tables in Lua. It
> reminds me of when I was learning c and always forgetting to place semicolons at
> the end of a line. I'm so happy that semicolons are optional in Lua. I wish
> commas were too.
>
Now, an omitted comma (except in examples specially concocted by DC)
is recognized at compile time. The program will not run and give incorrect
results. It is a harmless error.
Suppose that commas were optional. Spurious spaces are immediately
promoted to valid table delimiters. Consider the following incorrect code:
a = {3.715570115524504276103660468 E-100}
(I cut-and-pasted it from the output of another program. That program
puts a space before the E. I have no control over the format. )
At present I get a helpful error message for this, I correct it, and go on.
With the proposed change, if I happened to have given E a numerical value,
there is no error at compile time. Much later, I may recognize that the
calculated numbers are out by 100 orders of magnitude. It can easily
take a day's debugging to find such an insidious mistake.
All this, so that a programmer who is by own admission prone to forget
punctuation can have that weakness pandered to? No thanks.