W3C home > Mailing lists > Public > www-style@w3.org > July 2005

Hypothetical Syntax of Variables

From: Christoph Päper <christoph.paeper@tu-clausthal.de>
Date: Tue, 19 Jul 2005 04:56:56 +0200
Message-ID: <42DC6BF8.40705@tu-clausthal.de>
To: www-style@w3.org

Dear CSS WG and list members,

the idea of variables or constants in CSS has been discussed to death, 
with the conclusion to leave it to preprocessors etc. My question is: 
How should you do this syntactically, if you want to ensure that other 
parsers, esp. other editors, do not choke on the proprietary additions?

Constants, which cannot be overwritten, should be enough.

I assume the definition should happen in some kind of (vendor-prefixed) 
at-rule early in the stylesheet, like this:

   @-foo-define {constant: value}

Maybe it would be safer, if put into a comment, but comments get easily 
deleted and it would require more complex parsing.

Note that you could do more than simple string replacement with typed 
variables, e.g. no unit with zero, or all colors in hex notation.

The trickier part is the referencing, especially if you also want to 
support some basic calculations and do not want to interfere with future 
additions like 'calc()'. OTOH you could use 'calc()' and replace all 
resolvable expressions by their result. I have no idea yet how to do 
this best.

Regards,

	Christoph Päper
Received on Tuesday, 19 July 2005 02:56:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:39 GMT