Hypothetical Syntax of Variables

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 UTC