Re: [css-variables] Different syntax for variable definition and use

Le 17/02/2013 06:24, Jens O. Meiert a écrit :
> It seems CSS variables remain based on var-foo/var(foo). I stick to my
> argument that this is counter-intuitive.
>
> I don’t intend to argue against the current syntax forever, but I
> still like to ask, did we explore other syntactical options, like e.g.
> the following?
>
> foo { [var]: 20 }
> bar { line-height: [var]px }
>
> Generally, could someone—no offense, but maybe not Tab :)—explain why
> we are left with what we have now? I find it hard to believe that we
> have no options that are more usable, i.e. user-friendly.


The main argument is not changing the syntax for declarations:

    <name> whitespace* ':' <value>

… where <value> can be anything, but <name> can only be a single ident 
token.

I don’t think that the Core Grammar is really frozen (we’ve accepted 
multiple changes already, however minor.) But there is some resistance 
in changing such a fundamental concept as what is a "declaration".

Having worked on multiple parser implementations, I personally feel 
that, although non-trivial, such a change would be completely doable. 
There is no web-compat issue either: the error recovery rules ensure 
that old UAs drop declarations they don’t understand. It might be worth 
it if we have a vastly superior syntax proposal.


There is some agreement that the "var" prefix/function name could be 
changed, though.

Cheers,
-- 
Simon Sapin

Received on Sunday, 17 February 2013 18:57:17 UTC