Re: WebKit now supports CSS Variables

>> In any language, if you try to write something like "const x = 1" in 
>> file1 and
>> "const x = 2" in file2 (assuming that both file a defining the variable 
>> on the
>> same scope), you will get a compilation error and nothing of your code 
>> will
>> be compiled.
>
> Depends on many factors, cases and languages. In most languages you can 
> define constants with the same name but e.g. in different namespaces and 
> probably files.

If you are "assuming that both file a defining the variable on the same 
scope",
then it's not possible.

> CSS uses "silent recovery" method of parsing. So if you have
> two entities with the same name you have only two options in CSS:
>
> 1) first seen - first used. That is @const.
> 2) last seen - last used. That is @var.

Yes, but what's "first" seen ?

1. The first style that's sucessfully parsed ?
>  Then it's not possible for the developers to be sure which @const wil be 
> used.

2. The first sytle in the DOM ?
> Then, it can change during the application. So you can't use that for a 
> variable.

But you'll see it yourself, when you will need to make a true W3C Spec, 
defining exactly
all process that define how you compute a value of a constant.

Fremy

PS : Last seen is easy. It's the last in the document DOM. It can change and 
it's not a problem
if we decide to use variables. And it's the only way CSS have been parsed at 
any time. I see
no spec that say "first seen is first used". Because it's not possible to 
have "a first seen" that
you can assume as immutable for all the time the page will be running. 
Keywords are so.
But keywords are true constant... because it's not possible to override and 
disable them. 

Received on Monday, 30 June 2008 19:26:56 UTC