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

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

From: Brad Kemper <brad.kemper@gmail.com>
Date: Tue, 22 May 2012 08:15:48 -0700
Message-Id: <39E27D2E-A8C1-41BA-8559-0E9154FE3854@gmail.com>
Cc: www-style list <www-style@w3.org>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

On May 21, 2012, at 2:30 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:

> 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, there is already a magic prefix ('var-') for defining the variable, and now there would be one ('$') for using it too? I don't think I like that, because it feels less like normal CSS to me. Having a function for the value seems like a more normal CSS pattern, and thus, easier to understand and learn. 

> So, since some members of the WG already expressed a desire to see
> Variables switch over to this syntax, are there any strong objections?

I think this would cause trouble to people who use SASS, but still want some variable use in their final, rendered CSS. Also, I don't like the idea of a completely different pattern (functional notation) for similar use combined with a second argument, such as default. 
Received on Tuesday, 22 May 2012 15:16:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:16 UTC