- From: Andrew Fedoniouk <news@terrainformatica.com>
- Date: Mon, 30 Jun 2008 13:41:38 -0700
- To: Francois Remy <fremycompany_pub@yahoo.fr>
- CC: CSS 3 W3C Group <www-style@w3.org>
Francois Remy wrote: > >>> 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. It, again, depends on many factors. In C/C++ preprocessor you can do following: #define SOME_COLOR 0xFF0000 ... #if !defined(SOME_COLOR) #define SOME_COLOR 0x00FF00 #endif In the same way you can change value of defined constant/variable. By having first-seen-first-used (@const) you have an option to do the same in CSS @const SOME_COLOR: #0000FF; .... somewhere far away: /* if SOME_COLOR is not defined anywhere before let it be #00FF00 */ @const SOME_COLOR: #00FF00; > >> 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 ? "First" means first. In the same meaning as "latter" here: "if two declarations have the same weight, origin and specificity, the latter specified wins" http://www.w3.org/TR/CSS21/cascade.html#cascading-order That is natural cause-and-effect relation. And of course compiled (loaded) styles are not affected by runtime position of <style> in the DOM. -- Andrew Fedoniouk. http://terrainformatica.com
Received on Monday, 30 June 2008 20:42:29 UTC