Re: [csswg-drafts] Can we reinstate `<number-percentage>` and friends? (#9955)

Yes, I removed `<number-percentage>` because it's unsound as a type. You can multiply anything by a number and keep its type stable; multiplying by any typed value changes the type (and eventually needs a division to get us back to a useful type).

Percentages are potentially resolveable to anything. Currently, with the restriction against combining percentage and number in calculations, I can immediately infer the type of an expression containing percentages, even if I have no idea what the percentage resolves to yet. If they were combinable, tho, then I couldn't.

Now, granted, previously every instance that could have combined numbers and percentages was using them in a trivial way - the numeric range was either 0-1 or 0-100, so whether you spelled something `.25` or `25%` was just a stylistic choice. The presence of non-trivial reference ranges in the newer color syntaxes makes this a little unfortunate.

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


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

Received on Wednesday, 14 February 2024 16:22:12 UTC