Re: [css-variables] Using $foo as the syntax for variables

On 05/21/2012 02:30 PM, Tab Atkins Jr. wrote:
> Right now, the Variables draft makes variable names be simple idents,
> and uses the var() function to reference them.  This was *one* option
> for using variables, which I chose on the hope that it would make it
> easier for the group to accept the draft.
>
> Another possibility is to use a $ glyph as a prefix.  This was
> suggested by several people in the WG after I presented the current
> Variables draft, and it matches the way SASS does variables.  Chris
> Eppstein, one of the SASS devs, has been telling me repeatedly that
> the $foo syntax will be easier for devs.
>
> I was afraid of switching over because I already know that we want to
> extend the basic usage of variables to, for example, allow providing
> default values.  However, Chris pointed out that this isn't
> incompatible with the $foo syntax.  You could use ordinary variables
> without special abilities like "color: $foo;" but access the extended
> abilities with functions, like "color: var-default($foo, blue);".
> This seems acceptable to me.
>
> So, since some members of the WG already expressed a desire to see
> Variables switch over to this syntax, are there any strong objections?

Fwiw, unless you're planning to expand this type of variable to handle
all the other macro-expansion type things people are asking for, I'm
not at all convinced this is better.

~fantasai

Received on Tuesday, 22 May 2012 02:01:02 UTC