[Issue 5953] New: Too many trailing commas are accepted
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 7 16:32:04 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5953
Summary: Too many trailing commas are accepted
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: accepts-invalid
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-05-07 16:28:09 PDT ---
Accepting an extra trailing comma is acceptable, but this looks excessive (this
compiles and runs with no errors, DMD 2.053 beta):
void main() {
auto a = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
assert(a.length == 0);
}
As in Python I suggest to accept only one extra trailing comma:
>>> a = [1]
>>> a = [1,]
>>> a = [1,,]
File "<stdin>", line 1
a = [1,,]
^
SyntaxError: invalid syntax
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list