[flexcoders] Array literals - odd behavior

2013-04-11 Thread Dave Glasser
In Java and other C-derived languages, an array literal can have a comma after the last element, for example: int[] numList = {1, 2, 3,}; In ActionScript, you can do the same thing: var numList:Array = [1, 2, 3,]; In both cases, the array has a length of 3. The trailing comma is basically

Re: [flexcoders] Array literals - odd behavior

2013-04-11 Thread Paul A.
On 11/04/2013 18:30, Dave Glasser wrote: In Java and other C-derived languages, an array literal can have a comma after the last element, for example: int[] numList = {1, 2, 3,}; In ActionScript, you can do the same thing: var numList:Array = [1, 2, 3,]; In both cases, the array has a

Re: [flexcoders] Array literals - odd behavior

2013-04-11 Thread Dave Glasser
Yes, I think it matters quite a bit. It would be very easy for someone, even in their right mind, to unintentionally have an extra comma somewhere in the middle of a long array literal and not notice it. And the compiler would not tell them, but instead would insert an empty element at that

Re: [flexcoders] Array literals - odd behavior

2013-04-11 Thread Paul A.
On 11/04/2013 20:45, Dave Glasser wrote: Yes, I think it matters quite a bit. It would be very easy for someone, even in their right mind, to unintentionally have an extra comma somewhere in the middle of a long array literal and not notice it. And the compiler would not tell them, but

Re: [flexcoders] Array literals - odd behavior

2013-04-11 Thread Dave Glasser
Didn't say it was essential. Just that I would prefer it. As you said, nobody in their right mind would do it. One of the hallmarks of a well-designed language, IMO, is that it doesn't silently allow you to do things that no one in their right mind would do. At least a compiler warning would