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).

But once you know how to convert between the two, why not handle it seamlessly? E.g. `h + 20deg + 30` *does* make sense, just like `20% + 1em + 10%` makes sense in `<length-percentage>`.

> 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.

Why is this a problem?
(FWIW I’m not suggesting we expose these to authors via `@property`, only to use them internally for RCS)

> 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.

Yup.

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


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

Received on Friday, 16 February 2024 17:54:51 UTC