Re: [css-variables] cyclic dependencies involving fallback

Tab Atkins Jr. wrote:
> The paragraph in question was written before I added defaults, so I
> accidentally skipped dealing with this. :/
>
> I can go either way.  Can you describe what makes either difficult?
>
> Note the similar-looking but actually quite distinct case of:
>
> p {
>    var-a: var(b, 1);
>    var-b: var(a, 2);
> }
>
> Similarly, I can go either way with this.  Having them just be invalid
> seems okay, but so does having them resolve to a:1 and b:2.  I think
> those are the only two answers - we can't choose an arbitrary one to
> declare invalid and then resolve all the fallbacks from that point,
> because there's no distinguished "first" one.  They've either gotta
> all be invalid, or all be invalid-but-triggering-fallback, and I think
> I prefer just plain invalid here, since the latter involves two-pass
> resolution.  (Maybe n-pass? Not putting enough thought into it right
> now.)

I think you're right that it does need more work if you ignore the 
unused fallback variable references when determining whether a variable 
is invalid.  Also I'm not sure it's that useful; deliberately including 
cycles and then relying on fallback for them to resolve doesn't seem 
like a pattern that authors will need.  I think making them all invalid 
is simpler and is powerful enough.

(fremy may disagree about whether it's useful to allow it, though: 
https://bugzilla.mozilla.org/show_bug.cgi?id=950497#c3.)

Received on Monday, 16 December 2013 23:33:48 UTC