Re: [csswg-drafts] Updating the css `env()` function to enable selection by index from a list of pre-defined environment variables (#5622)

Reducing verbosity wasn't a goal for introducing `index()` — we were mainly concerned with two aspects: 
1. being able to represent the arbitrary values in spec (i.e. I don't *think* you could specify that `viewport-segment-n-width` is a variable that is potentially valid for all `n`)
1. compatibility with the existing `env()` syntax, given that the fallback value comes after the comma.  

If I'm wrong about (1) then adding the variables with permutations to the spec sounds like a reasonable path forward. Else what you proposed for extending the `env()` syntax to have an optional integer to the first 'argument' (before the comma) seems like a nice way to express this concept (and is less verbose than an `index()` function).

We were also thinking something like `index()` might eventually have broader applicability, say for use with `var()` assuming you could declare array-like variables, but again extending the syntax with an optional integer would work well in the same way.



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


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

Received on Thursday, 15 October 2020 08:22:05 UTC