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

25.05.2012, 12:58, "François REMY" <fremycompany_pub@yahoo.fr>:
>>  From: Tab Atkins Jr.
>>
>>  Okay, then we're debating personal taste.  Since I obliquely pointed
>>  to this thread in Twitter, I've received nearly a dozen people saying
>>  they're excited, and not a single negative voice (I'm sure they're out
>>  there, but I haven't heard them yet).  I also know that others within
>>  the WG are cool with this (some people mentioned this syntax when I
>>  first presented the modern draft at TPAC), so it's not even a "WG
>>  versus authors" divide.
>
> It's easier to get voices to acclaim a change than to keep things the same.
> Personnaly, I dislike the proposal to use the dollar sign for variables.
> This is a PHP-only convention, and one of the reason I dislike coding in
> PHP.

It's not a PHP-only convention. It's used in at least Perl and SASS too.

BTW, at the contrary, I _like_ PHP (compared with C++ or JavaScript, for example) for that it uses $ for variables in particular. So I can painlessly have same-named function and variable without need for ugly workarounds like making them named differently "just because syntax does not allow they to have same name". For example:

    $showMenu = true;

    function showMenu() {
        // Some logic that shows menu if $showMenu var is true.
    }

> I know many people who dislike to use $ for variables.

'Many' is an unconstructive abstraction. PHP is the most popular web-programming language while it uses "$" for vars, and it wasn't an obstacle for PHP to become that popular.

Actually, only way to know ratio between who like something and who don't is to poll publicly. But, AFAIK, W3 have no such functionality (they have even disabled built-in voting in bug tracker for some reason).

> Beside the fact
> some poeple don't like it, this doesn't follow the established CSS
> conventions.

As someone said in this thread before, variable is a new primitive. It's natural for it to have a dedicated new syntax.

> Also, please keep in mind that we don't all have EN-US keyboards. On French
> keyboards, typing $ is akward. One time over three, I endup typing a ^
> instead. Having to type a $ hurts my typeflow.

I believe the thread is not about specific _character_, but is about entire _concept_ of using character as token for variables instead of redundant and unusable functional notation like var(). Specific character could be "^" instead of "$" -- with generally the same result (though I would prefer "$" anyway).

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

IE6/7 are very old browsers (e.g. in Russia, IE6/7 have just 3% in total, and I don't support them anymore) with very small (and constantly decreasing) market share and therefore their bugs by nature cannot be any important for long-term decisions.

Received on Friday, 25 May 2012 15:05:10 UTC