
On 2007 Feb 2, at 1:03 PM, Neil Mitchell indited:
The argument that a trailing comma "means" "the programmer forgot the last item" in a list / tuple is inconsistent with the deliberately explicit permissiveness of a trailing comma in the import / export lists. In the import / export lists such a trailing comma does not mean "programmer forgot additional thing at the end."
An import list is not a value, you can't examine whats in the list, you can't enumerate it etc. As such, it doesn't really matter how many elements are in there, the important thing is what the elements are.
I don't know enough about it, but mightn't Template Haskell disagree on that point? Or any other source-level manipulators? (perhaps that shouldn't be a consideration?)
A real list/tuple IS a value. A 3 element tuple is completely different from a 4 element tuple.
I don't dispute that.
Thats the difference, there is a real semantic difference - its not a case of inconsistency.
Personally I'd make the rule that trailing commas are never allowed, anywhere, but I do see an argument for adding them to import lists.
You just highlighted the inconsistency: You refer to "import lists"... you appear to think of the import syntax _as a list_, and it is precisely that mental processing where the inconsistency hits/grates. If it is an "import" _list_ it can have trailing commas, but if it is some <other> _list_, it can't. I don't see the justification for making those two cases different. --D'gou