RE: [css-variables] Proposed implementation needlessly complex

On Friday, February 10, 2012 10:03 AM Tab Atkins Jr. wrote:
> 
> On Thu, Feb 9, 2012 at 7:42 AM, Ernie Bello <ernie@ern.me> wrote:
> > Web developers have long taken advantage of CSS metalanguages like
> > Sass or LESS to make the benefits of variables a reality before this
> > spec was introduced. The problem I see with the spec as currently
> > written is that the W3C's implementation differs quite a bit from the
> > accepted conventions of these metalanguages.
> >
> > Variables should be easy: define a symbolic name for what you need and
> > set it to a value. In order to retrieve the value, use the variable's
> > symbolic name. To use Sass's implementation as an example:
> > $link-color: blue;
> > a { color: $link-color; }
> >
> > LESS's implementation differs only in the initial character used to
> > define a variable, it uses the @ symbol instead of the $. In contrast,
> > the W3C's proposed implementation is needlessly complex. The W3C
> > equivalent to the above example:
> > :root { data-link-color: blue; }
> > a { color: data(link-color); }
> 
> I don't see how this is any more complex.  You set up a variable, and then use
> it.  The syntax is slightly different, but that's it.
> 
> (Also, I think I'll add back the ability to do "color: $link-color;".
> I switched to a function to make the proposal more palatable to many in the
> WG, and to make it more extensible, but at minimum I think that having $foo
> in addition to data(foo) would be good.)
> 

Tab, I think you are forgetting why you switched to a function. The $link-color as a value is a violation of the core grammar. We are trying to avoid changing that grammar even for variables. The "$" is the problem in the grammar. If we go with a function then we are fine. Also in my opinion the function is more explicit on what you are doing thus easier to explain to people where the values are coming from.

--
Thanks,
Arron Eicholz

Received on Friday, 10 February 2012 18:48:25 UTC