Re: [Css Variables] Variable Declaration Blocks

On Oct 18, 2008, at 7:21 AM, fantasai wrote:

>
> Mike Wilson wrote:
>> Andrew,
>>> We've found that natural constants first-seen-first-used approach
>>> works just well. For example:
>> You suggested the same thing back in June and it was discussed here:
>> http://www.nabble.com/WebKit-now-supports-CSS-Variables-td18076178i60.html#a
>> 18162114
>> or
>> http://lists.w3.org/Archives/Public/www-style/2008Jun/0351.html
>> ..
>> and I agree with the other posters at that time that it would be  
>> confusing to have "first rule overrides later rules" for variables/ 
>> constants when the rest of CSS uses "last rule overrides
>> earlier rules".
>
> I agree with that as well. If fallbacks are important, then we can
> define some syntax that explicitly says it's a fallback.
>
> @define fallback values {
>  foo: bar;
> }

Or perhaps:

/* override-able by later rules:  */
@define {
	foo: green;
	bar: 12px;
}

/* non-override-able by later rules:  */
@define constant {
	baz: orange;
	qux: 3em;
}

Constants are nearly as common in programming languages as variables,  
so the word "constant" is well known to mean that any subsequent  
attempts to assign new values to it later should fail. By the way, I  
don't find it confusing at all. Constants exist to be non-changeable  
by later statements, so if you call something a constant, its behavior  
in that respect is very clear.

Received on Saturday, 18 October 2008 19:37:50 UTC