- From: Francois Remy <fremycompany_pub@yahoo.fr>
- Date: Mon, 30 Jun 2008 19:53:56 +0200
- To: "Brad Kemper" <brkemper@comcast.net>, Christoph Päper <christoph.paeper@crissov.de>
- Cc: <www-style@w3.org>
> In practice, a constant would be similar to a keyword, but one that you > create yourself. Which is why it would make sense to set it somewhere > near the top, and not have it change. If people do not have a problem > with "orange" being constant, then what is the problem with > "myCompanyColor" being constant, once it is defined? The point is not to > prevent people from finding some JavaScript loophole method around its > constancy, it is to allow you to have the keyword-like values that you > create yourself. > > Constants are not impossible in the cascade model of CSS, any more than > keywords are. Not really. Not at all, in fact. It's fondamentaly different because the browser know the value of all constants before loading the site, because it's the browser itself that define some constant. And not the site. A constant must be defined BEFORE the program run. It's so that constants are defined in all programming languages. This is in fact the compiler that remove all reference to the const and that replace it by the constant's value. 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. 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. 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... Fremy
Received on Monday, 30 June 2008 17:54:42 UTC