- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Sat, 20 Mar 2021 00:45:01 +0000
- To: public-css-archive@w3.org
"NaN used as flag for smuggling an extra boolean into an attribute defined as a double" is different than "NaN produced as result of erroneous math". Like I said, languages with weaker or less ergonomic type systems do the former to avoid having to burden their APIs with carrying around an extra boolean, and are okay with accepting that it unfortunately conflates with the latter case (and thus some erroneous code is instead interpreted as correct code that does something different). CSS does not need to do that. Are you really wanting to argue that `hsl(calc(0deg/0), ...)` **should** be treated as an achromatic color? Like, that's intentionally something you desire for this function? Because I think you'll have a really hard time selling that to the WG, when CSS already has a way of indicating non-`double` values (namely, *a keyword*). CSS has many examples of a value that is either numeric or a single keyword like `none` or `normal`; in exactly *none* of these do we smuggle the non-numeric value in via a numeric sentinel value, and I don't see why this case justifies doing so. > No, it is caused by colorspace conversion regardless of whether you plan to interpolate it Sure, but all such conversions are censored away into a color with a hue before authors see it, right? That's the point I'm making there - this is a spec-internal concept that is only exposed to authors by way of the effect it has on other processes; it never shows up in a serialization, and authors can't write it directly on their own. (Tho fwiw, as far as I can tell your general statement is not true; colorspace conversions don't produce NaN. The only example in the spec that describes converting from a hue-less to hue-ful representation is [converting Lab to LCH](https://drafts.csswg.org/css-color-4/#lab-to-lch), where H is calculated as `atan2(b,a)`. If the Lab color is achromatic (a and b both 0), `atan2(0,0)` returns 0. The HSL section doesn't list an RGB->HSL conversion; the HWB section *does*, but it references an `rgbToHsl()` function that doesn't exist in the document or any of the supporting `.js` files, so I can't tell how it would calculate the hue of an achromatic RGB color. However, I think the common practice is to explicitly check for the max and min RGB channels being equal, and returning 0 for that case. The only mentions of a NaN hue are in [4.2, defining <hue](https://drafts.csswg.org/css-color-4/#hue-syntax), and the interpolation section.) -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6107#issuecomment-803209602 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 20 March 2021 00:45:03 UTC