- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Tue, 15 Dec 2020 01:00:43 +0000
- To: public-houdini-archive@w3.org
> We can make many more APIs avoid errors by severely restricting what they can do, that doesn't help authors either. There's a balance needed. Allowing authors more flexibility at the risk of allowing them to make mistakes is a common trade off. True, though I'm not convinced saving the user one division with 255 is a worthy trade off. > > Please note that the TAG guidelines you link to (both of which I'm aware of and have even taught) do not apply here. > > The principles they represent do apply. Both Tab and I have explained why they do not: 1. all arguments (besides `a`) are required (assigning an arbitrary default can theoretically make any argument optional, but in this case that's externally inconsistent) 2. There is a very well established order, and arguments never/rarely need to be provided in a different order. > Back to Tab's original question, I'm now fairly well convinced that bare numbers passed into the constructor of a `CSSRGB` object (regardless of how they're passed) should be interpreted the same as bare numbers passed into CSS `rgb()`. This is an object model of the CSS `rgb()` function, it needs to match the semantics of the `rgb()` function. Full stop. I have no issue with convenience functions or conversions from other types that take 0-1 numbers, but will strongly object to redefining the semantics of the `rgb()` function in the object model. It should be all about modeling the `rgb()` function as it exists, not about creating a new general purpose color object (which I'm in favor of, and agree should use 0-1 numbers). Similarly, object models of other CSS color functions should accept the same arguments as their CSS equivalents. You feel so strongly that the function should mirror the semantics of `rgb()`, yet you are opposed to it using positional arguments, *just like `rgb()`*. 🤔 Please note that `color(srgb)` uses the 0-1 range when provided with bare numbers. Are we really going to have two different sRGB objects with components in different ranges? -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/1014#issuecomment-744927480 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 15 December 2020 01:00:45 UTC