W3C home > Mailing lists > Public > www-style@w3.org > May 2012

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

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 21 May 2012 19:00:07 -0700
Message-ID: <4FBAF327.60300@inkedblade.net>
To: www-style@w3.org
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.

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

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:15 UTC