Re: [css-variables] Variables used without prefix or function

Tab Atkins Jr. (2012-05-24):
> 
> I don't see what the benefit to the author is of making variables be simple keywords.

It’s the easiest of all syntaxes.

> This would make it hard to spot variables in use, as they look just like every other keyword.  

With counters or font families you have the same problem, which is none.

> It would make it confusing to combine with other keywords.

Keywords are confusing as they are, because there are so many different types of them which aren’t explicitly distinguished anywhere. Adding user-defined variables into their “namespace” doesn’t make it any worse, because we already do so elsewhere.

> It introduces the need for precedence rules which mean that *sometimes* an ident is a keyword and other times its a variable.

Yes. I tried to explain that it hardly ever matters and if it does people are doing it on purpose. most of the time.

> This suggestion has a lot of bad usability problems, and the benefit is that you can omit a single character (the $ prefix).

I think enough argument have been brought up against the ‘$’ prefix, but saving a few characters, i.e. “var(” and “)”, to type is not the main benefit. The main benefit, actually, is usability, because authors could use variables just the same as anything else they use, including stuff they defined themselves (counters, fonts, pages …).

> This seems pretty easy to reject.

Of course, for a programmer, if they don’t take a minute or two to think about it.

Received on Monday, 28 May 2012 13:14:34 UTC