W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Proposal for adding variable declaration blocks

From: Simetrical <simetrical@gmail.com>
Date: Fri, 18 Jul 2008 14:52:10 -0400
Message-ID: <7c2a12e20807181152t1164fe29m33c5d5f27e8f9c49@mail.gmail.com>
To: "James Elmore" <James.Elmore@cox.net>
Cc: "www-style list" <www-style@w3.org>

On Fri, Jul 18, 2008 at 2:41 PM, James Elmore <James.Elmore@cox.net> wrote:
> By the way, (possibly I missed this) is there a suggestion about using the
> variable sigil (interesting word -- I would use indicator) for the variable

I got it from Wikipedia, and I think it's an amusing term, so I'll go with it.


> Would it make CSS parsing easier if every use of the variable (LHS and RHS;
> setting and getting) required a sigil? Or would that make things more
> complex, because then idiots could do things like:
> <style>
>    declare { $color: #00ff00; }
>    h1 { color: $color; }
> </style>

If some kind of sigil is used, there's no reason to prevent keywords
from being used in variable names.  The sigil will effectively
distinguish variables from keywords.  For comparison, other
implementations I'm aware of (PHP and bash, mainly) reserve no
variable names -- $function, $while, and so on are perfectly valid.
(Both do predefine certain variables before the program begins
executing, but those variables can generally be changed like any

With the huge number of keywords CSS uses, it seems like a good idea
to avoid conflicts, as I remarked previously.  In some contexts,
$color would be a very reasonable choice for a variable name.  I don't
think you'd have to be an idiot at all.

As for whether to use the sigil in the declarations as well, I don't
think there would be any difference in terms of parsing it, in the
syntaxes that have been contemplated so far.  I think it's more
intuitive to use the same name in declaration and use, not require an
extra character for one but not the other.
Received on Friday, 18 July 2008 18:52:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:38 UTC