Re: WebKit now supports CSS Variables

Francois Remy wrote:
> 
> In CSS, we have no compiler. So, the "validity" of the constants cannot
> be checked before the program became compiled, because the constant
> can be created at any moment.

And what is the name the thing that gets CSS source (text) and builds
correspondent data structures as a result?

> 
> 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.

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.

@const does not require any major changes in CSS parsing and handling.
@var requires change of CSS paradigm - @vars require at least
some additional interpreting layer.

> 
> In CSS, this is not possible, because you can't check all stylesheets 
> before
> loading thems, because the JS can add some new stylesheet later... or 
> because
> a stylesheet can change when the media change !
> 
> Well, I see no solution...
> 

You see no solution to what?

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Monday, 30 June 2008 19:07:15 UTC