Re: [csswg-drafts] [css-values][css-images] Allow trailing comma in gradient functions (and probably others) (#4968)

I'm definitely not liking the special cases here. Each one sounds at least somewhat reasonable on their own, but the end result is that people have to *think* about where trailing commas are allowed or not (it's not obvious syntactically; you have to consider the value semantically), and spec writers have to think about how to structure their grammars to allow it in places that aren't covered by the single blanket "`#` can have trailing comma" rule.

All together, it's a lot of work on *everyone's* part, which authors will make annoying mistakes with and spec authors and implementors will get wrong and inconsistent, all for the dubious benefit of "no trailing commas in places where it doesn't quite make sense".

Extraneous/meaningless trailing commas aren't a problem in JS. You can put them on single-arg functions, you can put them on "fixed arg-length" functions, you can put them in tons of places. They're just a separator that's allowed to end any comma-separated collection, so you don't have to think about where it's "appropriate" to have them; they're allowed anywhere you might expect them to be, automatically and all the time.

I'm still strongly supportive of @emilio's original position here, that we should make this a general *syntax* feature of CSS, not a grammar-specific feature that's allowed in some places but not others.

-----

As an aside:

> Wish we had went with a combinator that meant "either or both but in this order".

Remember that we ended up going with `!` over that combinator because such a combinator would only support space-separation, and a lot of our examples for wanting this semantic, such as `color()` or `image()`, were using comma-separation. We'd either have had to create two variants of it (at least; a `/`-separated version might also be warranted) or we'd have only solved a subset of the cases we cared about and would still have had to do the awkward/unreadable grammars for commas; both of these possibilities were bad, so we rejected it and went with `!`.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4968#issuecomment-656768096 using your GitHub account

Received on Friday, 10 July 2020 16:32:53 UTC