Re: [css-houdini-drafts] [css-typed-om] Change CSSKeywordValue's attribute to allow forward-compatible upgrades

So to check my understanding: suppose a property only took single keywords and we reified them as `CSSKeywordValue`s. The property is then changed to allow multiple keywords. Then there are two possible approaches that I can think of:

1. We still reify single keywords as `CSSKeywordValue`s, but reify multiple keywords as a new type `ComplexValue`. Upside is 100% backwards compat (AFAICT). Downside is that writing generic code that works on both `CSSKeywordValue` and `ComplexValue` is difficult as you have to handle both types. Another downside is that new types can accumulate over time.

2. [your suggestion I think?] Alternatively, reify both single & multiple keywords as a new type `ComplexValue`. Backwards compat as long as no one is relying on the types staying the same (which I believe they're not supposed to anyway). Any operation that was valid for `CSSKeywordValue` must also be valid for `ComplexValue`. In other words, `ComplexValue` "implements the `CSSKeywordValue` interface".

For me, I agree option 2 sounds better, but there might be more options that I haven't thought of.

-- 
GitHub Notification of comment by darrnshn
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/735#issuecomment-375485712 using your GitHub account

Received on Thursday, 22 March 2018 23:03:59 UTC