- From: Brandon McConnell via GitHub <sysbot+gh@w3.org>
- Date: Sat, 04 Feb 2023 08:33:50 +0000
- To: public-css-archive@w3.org
> > though I think it would help to whitelist certain usages of spread() like using it within the random-item() function. > > > > What are you imagining this would help with? When used directly in `random-item()` the function would do literally nothing. The point of my comment was that I think `spread2()` only being valid in custom properties would reduce the chance of such confusing/redundant usage. I was thinking that if a list could be stored in a variable on its own without needing `spread()`, it could then be used in other functions like `nth()` as well as `random-item()` via `spread()`. In other words, this would be valid: ```css :root { --colors: (blue; red); /* possibly wrapped by `list()` other something equivalent } main { background: linear-gradient( nth(first; spread(--colors)), nth(last; spread(--colors)) ); color: random-item(--x; spread(--colors)); ``` > > If we were to introduce some kind of list/set function that actually houses lists of args and makes them reusable > > > > There's no need for such a function; as long as your list isn't semicolon-separated, custom properties already hold "lists of args" just fine, and `var()` makes them reusable. Would a list of args not be semicolon separated? Would it then not need spreading? I guess my thought here was that the general syntax for lists could be that of a semicolon-delimited list, which could be used in other functions like `nth()`, `random-item()`, and likely others via `spread()`. To that point, I think it boils down to whether there is ever a case we _**wouldn't**_ want such a list to be spread. If the only value of a list is for its arguments/values to be later spread, then yes, I think either of your proposed options would work perfectly. In that case, we wouldn't need any sort of `list()` function, as `spread()` would essentially do the same thing. And in this case, per your note, we wouldn't use `spread()` one functions then— only custom properties. If that's the case, could we still interface other functions to be able to consume those arg lists? The `nth()` idea, for example: ```css :root { --colors: spread(blue; red); } main { background: linear-gradient( nth(first; spread(--colors)), nth(last; spread(--colors)) ); ``` -- GitHub Notification of comment by brandonmcconnell Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8391#issuecomment-1416697511 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 4 February 2023 08:33:51 UTC