Re: [CSSWG] action 38, CSS Variables

On Apr 8, 2008, at 3:50 PM, Bert Bos wrote:

> If some feature can be done outside of CSS, especially a feature  
> that is useful for other technologies than CSS, then is it should be  
> done outside of CSS. Modularity avoids implementing things twice,  
> allows parallel developments and re-use.

If a single CSS variable or constant can hold a string of related  
property/value assignments or a string of complex selector text, then  
it helps to make CSS more modular. Each of those strings becomes a  
small module that can be plugged into other rules.

> Indirection is bad, because too few people understand it. Half the  
> people don't understand that EM refers to a style rule in a  
> different file and that that style rule makes the text italic. Every  
> further indirection we add halves our audience.

I agree with Andrew, that it is really not much more indirect than the  
cascade, and probably much easier to understand. You are simply  
assigning one value into another. It is actually less indirect than  
shorthand notations, such as "border" or "background". With those, you  
are more or less assigning multiple values to multiple properties by  
means of a separate property (an "array", more or less, to use  
programming terms). With the Glazman/Hyatt proposal, you are just  
assigning a single value to a single value by means of a separate  
"function".

> Variables in CSS are wrong for the above three reasons. They make  
> the language bigger and more difficult to learn,

Someone learning CSS would not be required to use properties and  
notations they don't yet understand. There are other things in CSS a  
lot more complicated than this (like "CSS Template Layout Module").

> they make other people's style sheets more difficult to understand  
> and re-use.

au contraire. When done right, they can make other people's style  
sheets easier to read and edit, because property values that are  
reused throughout the sheet can be changed in a single place. If the  
idea was extended to selectors and to groups of property/value  
assignments, it would help eliminate a lot of the clutter and  
verbosity of current sheets and make them even easier to read and  
understand, once you had a minimal understanding of the mechanism.

> They can instead be done with a generic macro processor and would  
> then be useful for other languages, too (HTML, SVG, Javascript,  
> Atom, etc.). They introduce extra indirections.
>
> Computer scientists love indirections, they believe all problems can  
> be solved with them, but normal people hate them.

Many, many normal Web page authors understand both JavaScript and CSS,  
and variables are the most basic thing anyone learns when learning  
JavaScript.

> Programmers program their video recorders, normal people prefer to  
> press the Record button at the right moment. Programmers use text  
> editors, normal people use Direct Manipulation interfaces (what's  
> often incorrectly referred to as WYSIWYG).

Now you are arguing both sides of the fence. If someone is using a  
WYSIWYG editor because they don't edit the text directly, then why  
should they care about indirection, or what the code that the editor  
produces looks like? Personally, I rarely use a graphical Web page  
editor, except as a shortcut to converting big blocks of text into  
HTML text with entities. Check the Web sites of authors who  
consciously design with CSS, and you will find nary a mention of  
editing it in any other way that direct text editing. "Normals"  
without any understanding of CSS can continue to blithely use their  
WYSIWYG editors without being affected at all.

>
> Bert
> -- 
>  Bert Bos                                ( W 3 C ) http://www.w3.org/
>  http://www.w3.org/people/bos                               W3C/ERCIM
>  bert@w3.org                             2004 Rt des Lucioles / BP 93
>  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
>

Received on Wednesday, 9 April 2008 16:56:03 UTC