- From: Florian Rivoal <florianr@opera.com>
- Date: Wed, 23 May 2012 11:19:23 +0200
- To: "Chris Eppstein" <chris@eppsteins.net>
- Cc: www-style@w3.org
On Tue, 22 May 2012 22:56:16 +0200, Chris Eppstein <chris@eppsteins.net> wrote: >> 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. > > Variables NEED to look different from properties because they are a new > primitive. That they adhere to the cascade is a natural behavior for CSS. > They will figure it out, they are smart. Variable declaration and inheritance works pretty much exactly like properties, so looking like properties is a good thing. Variable usage is indeed a new concept, but in my mind, the functional notation is a clear enough indication that something special is going on. I like the $ syntax in SASS, because I think it is a good match with its behavior. Anyone who knows about variables in usual programming languages and runs into a SASS style sheet will have no difficulty guessing how they work. The same isn't true of CSS variables: you have to understand the cascade to have any clue about what these do, so I think a syntax that could imply otherwise is needlessly confusing. Even if authors can figure it out eventually, avoiding unnecessary confusion is a good thing. >> 2) It is less disruptive of the grammar > > This is not a reason. It is a new primitive, changing the grammar makes > sense here. Please state why the grammar changing is bad. In CSS 2.1, the CSS working group made the explicit promise not to change the core grammar in future updates: http://www.w3.org/TR/CSS21/syndata.html#syntax This assumption may be built into a number of pieces of software, which may fail in unexpected ways if we break it. Just to take one example, current installations of SASS will fail to process files that use the $ syntax with the CSS semantics. Given this as input, SASS fails produce any output. p {$foo:blue} span {background:$foo} You're willing to change SASS, but that will not affect any already deployed version, and there may be countless other tools that would similarly break, some of which may not be actively maintained. While one should never say never, I think the basic idea is sound, and that the working group should be reluctant to change the core grammar. Despite that, it may be worth breaking when doing so is necessary to introduce new desirable features, but in this case, it isn't necessary. While some, like you, prefer the $ syntax, the var- syntax is a viable option. >> 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. > > Only sass uses $ for variables, and we are committed to supporting this > change to CSS by changing Sass to accomodate. Please read my comments > from > back in February on this subject: > http://lists.w3.org/Archives/Public/www-style/2012Feb/1009.html I appreciate your commitment to work around what we end up deciding on, but I since I don't think it would benefit CSS to adopt this syntax, I don't see the point of pushing you to do that work, even if you're willing. - Florian
Received on Wednesday, 23 May 2012 09:20:21 UTC