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

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

From: Florian Rivoal <florianr@opera.com>
Date: Tue, 22 May 2012 10:24:49 +0200
To: www-style@w3.org
Message-ID: <op.wepaznl04p7avi@localhost.localdomain>
On Mon, 21 May 2012 23:30:34 +0200, Tab Atkins Jr. <jackalmage@gmail.com> 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 prefer the current var- syntax over $ for several reasons:

Because var-foo looks like regular property, its hint towards the
fact that the behavior involves the cascade. $foo doesn't. It looks
like SASS or perl or BASIC variables, which don't involve the
cascade, and that will probably confuse authors.

It is less disruptive of the grammar

While the various extensions proposed can be done as you said with
a function on top of the $ syntax, it feels hacky to me. Expressing
it based on the var() syntax seems much more natural.

4) Because SASS variables and CSS variables behave differently,
I can reasonably see authors wanting to use either, or
even wanting to use both in the same style sheet. Using the same
syntax is asking for trouble.
Received on Tuesday, 22 May 2012 08:25:40 UTC

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