W3C home > Mailing lists > Public > www-style@w3.org > December 2013

Re: [css-variables] cyclic dependencies involving fallback

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 16 Dec 2013 17:27:31 -0800
Message-ID: <CAAWBYDChgN=2vzh6y+FQbLLxHT-Xg53LiuP4sMbRCydzSMCajQ@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: www-style list <www-style@w3.org>
On Mon, Dec 16, 2013 at 3:32 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> 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.)

Yeah, on further thought, I doubt that it's ever useful to allow
fallback cycles to be specified.

(I was thinking that dependency systems often allow cycles to be
defined, with the assumption that the user of the system will override
one of them, like "let a = b * 4/5; let b = a * 5/4;".  That's done by
just providing the properties directly, though:  "var-a: calc(var(b) *
4 / 5); var-b: calc(var(a) * 5 / 4);".  I can't come up with a reason
to use a cycle in a fallback sense.)

~TJ
Received on Tuesday, 17 December 2013 01:28:19 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:17 UTC