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

On Tue, May 29, 2012 at 2:59 AM, Florian Rivoal <florianr@opera.com> wrote:

> On Fri, 25 May 2012 18:55:39 +0200, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>
>> If you don't like typing $, it's increasingly difficult to avoid it.
>> I suggest modifying your keyboard layout.  I do that when I'm writing
>> a lot of Lisp, for example - I swap my () and [] so I can type parens
>> without Shift.
>>
>>  BTW, if you want a more important reason not to change the CSS grammar to
>>> allow the DOLLAR symbol, I have one:       html { $color: red; }
>>>  makes
>>> the text color red in IE6 and IE7.
>>>
>>
>> That's an interesting point, but not an important one in my opinion.
>> IE6 is finally dying out.  IE7 is still quite present, but on its way
>> out.  Obviously, neither of them support variables.  All you have to
>> do is not name your variables the same as CSS properties in the
>> stylesheets that they receive.
>>
>
> While I am not overly worried about IE6 at this point, this still is
> a good example of what happens when you break expectations about the
> syntax. Sure IE should have rejected the syntax, but it didn't. And
> despite all the complaints about it now, IE6 was still a well
> engineered product. A lot of things that deal with CSS got
> significantly less QA time, and I would be surprised if tools
> didn't break left and right with something like this.
>

On the flipside, though, the fact that IE6-7 disregards $ in this manner is
a reminder that the character has been unused so far. You could say that it
has been inadvertently reserved for this occasion. It's not legal for any
other use, and carries no pre-existing meaning with it in the context of
css. It could hardly have been planned better.

I wish someone had time to test tools left and right to find cases that
break. The example mentioned wouldn't be a problem, of course, since the
author could simply rename the variable to support IE6-7. Perhaps there are
more severe issues out there somewhere. I tend to doubt it, but that
doesn't constitute an argument.

If I had a better grasp of history, I would try to articulate the dangers
of incorporating implementation bugs into de-facto, unwritten
specifications. Backwards compatibility is beneficial, clearly, but over
years and decades, it can also weigh down a platform with little pieces of
cruft and inconsistency that become a heavy burden. Or it can just make a
language less beautiful and convenient than it might have been.

I'm also still trying to see the perspective of those who find var-foo to
be more aesthetically pleasing. I'm not there yet, but if it were to go
that way, I'd get over it. You just need to use SASS so you can feel the
elegance. :)

Received on Tuesday, 29 May 2012 19:04:20 UTC