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

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:

1)
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.

2)
It is less disruptive of the grammar

3)
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