[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Thoughts on optional commas
- From: Jay Carlson <nop@...>
- Date: Mon, 5 Mar 2012 20:00:37 -0500
On Mar 5, 2012, at 2:03 PM, Javier Guerra Giraldez wrote:
> On Mon, Mar 5, 2012 at 1:14 PM, Jay Carlson <nop@nop.com> wrote:
>>> In addition, the ability to add a trailing comma makes adding new items
>>> to the list and rearranging the order of the list items less of a hassle
>>> in Lua than in JavaScript.
>>
>> I got screwed by expecting JavaScript to do the right thing. In C, it makes perfect sense to imply a trailing NULL entry. In languages that carry length with arrays, no.
>
> i don't think that was about NULL termination, but that in some
> languages, the last element of a list or dictionary can have a
> trailing comma; but in JavaScript this is undefined.
> in most implementations this works as expected; but in IE it fails at runtime.
OK, I give up. Which stone-age C implementation taught me that
char *foo[] = {
"bar",
"baz", /* <-- trailing comma */
}
could have length 3 and foo[2] == NULL? Anybody?