Creating this issue as requested on mastodon.
Calling a custom function is only place in CSS where the expected/established DX of vars effectively spreading in-place doesn't happen.
--rgb: 255, 0, 0;
color: rgb(var(--rgb));
As a CSS author, this anti-spreading behavior feels broken/unexpected.
(and is incredibly disappointing to not have access to the enormous potential of argument spreading)
It was originally planned and assumed as the rational expectation:
#11190 (comment)
It appears that it was implemented:
https://issues.chromium.org/issues/390205875#comment3
and then cancelled shortly after (afaik, without public discussion):
https://issues.chromium.org/issues/390205875#comment5
The {var(--csv)} syntax to prevent spreading makes sense from the perspective of a CSS author and is implemented / shipped.
The primary counter argument caters to non-CSS developers, stating that other languages don't auto spread arguments so CSS custom functions shouldn't either.
I whole heartedly disagree with the conclusion of this counter argument but so far I have stood alone in intention to question it.
Other counter arguments I've seen are situational and don't uniformly apply (like when arguments are typed, the evaluation happens anyway, etc).
For context, I have written dozens of complex custom functions, including working, trivial DX, --repeat() and --loop() functions, an entire bitwise suite, and am actively writing many more.
I know questioning decisions already made is not a pleasant thing to do so I apologize for that while still being incredibly hopeful that the expectation will be restored.
It also seems like it would be difficult to maintain erroring when too many arguments are used in the call... though I also want to say that it is confusing DX to try debugging why a function isn't working at all. (Is something cyclic? A semicolon missing? Comma missing? Something else?) Without a CSS error console, it is much much easier to debug an incorrect argument causing weird behavior than to experience when a function isn't returning anything at all.
Creating this issue as requested on mastodon.
Calling a custom function is only place in CSS where the expected/established DX of vars effectively spreading in-place doesn't happen.
As a CSS author, this anti-spreading behavior feels broken/unexpected.
(and is incredibly disappointing to not have access to the enormous potential of argument spreading)
It was originally planned and assumed as the rational expectation:
#11190 (comment)
It appears that it was implemented:
https://issues.chromium.org/issues/390205875#comment3
and then cancelled shortly after (afaik, without public discussion):
https://issues.chromium.org/issues/390205875#comment5
The
{var(--csv)}syntax to prevent spreading makes sense from the perspective of a CSS author and is implemented / shipped.The primary counter argument caters to non-CSS developers, stating that other languages don't auto spread arguments so CSS custom functions shouldn't either.
I whole heartedly disagree with the conclusion of this counter argument but so far I have stood alone in intention to question it.
Other counter arguments I've seen are situational and don't uniformly apply (like when arguments are typed, the evaluation happens anyway, etc).
For context, I have written dozens of complex custom functions, including working, trivial DX, --repeat() and --loop() functions, an entire bitwise suite, and am actively writing many more.
I know questioning decisions already made is not a pleasant thing to do so I apologize for that while still being incredibly hopeful that the expectation will be restored.
It also seems like it would be difficult to maintain erroring when too many arguments are used in the call... though I also want to say that it is confusing DX to try debugging why a function isn't working at all. (Is something cyclic? A semicolon missing? Comma missing? Something else?) Without a CSS error console, it is much much easier to debug an incorrect argument causing weird behavior than to experience when a function isn't returning anything at all.