Re: [csswg-drafts] Declarative custom functions (#7490)

Do we need initial values for when the function is referenced with too few arguments? 

I think it would be sufficient to rely on the initial value always being the [`guaranteed-invalid value`](https://www.w3.org/TR/css-variables-1/#guaranteed-invalid)?

Providing an argument with wrong syntax would also result in a `guaranteed-invalid value` at compute time, so I guess it would be fine if both "missing argument" and "wrong argument" resulted in  the same `guaranteed-invalid value`?

##### example: initial values for arguments
```css
@custom-function --double-length(--length) {
   arg-syntax: --length "<length>";
   /* could be ambiguous with multiple arguments (i.e. one is "<length>#") */
   arg-initial-values: 0px; 
   result: calc(2 * var(--length, 20px));
} 

.use {
   height: --double-length(); /* 0px */
   width: --double-length(red); /* 40px */
}
```

##### example: missing arguments results in guaranteed-invalid values
```css
@custom-function --double-length(--length) {
   arg-syntax: --length "<length>";
   result: calc(2 * var(--length, 20px));
} 

.use {
   height: --double-length(); /* 40px */
   width: --double-length(red); /* 40px */
}
```

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 23 July 2022 09:39:28 UTC