W3C home > Mailing lists > Public > www-style@w3.org > August 2012

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

From: Chris Eppstein <chris@eppsteins.net>
Date: Tue, 28 Aug 2012 18:29:57 -0700
Message-ID: <CANyEp6Wicy93M3vfSVbWQRtPwCLpzyYm+EwGF9mYm+bv8uFwkQ@mail.gmail.com>
To: Brian Kardell <bkardell@gmail.com>
Cc: "Jens O. Meiert" <jens@meiert.com>, www-style@w3.org
I'm on record as getting behind this spec as custom properties if they are
_really_ like properties and reading them is the same as reading non-custom
properties.

E.g. I like:

Set:
-user-foo: 50px;

Read:
width: value(-user-foo);
height: value(width);

Otherwise, I stand by my assertion that the left hand should match the
right hand and that a sigil is the best syntax (doesn't have to be $) for
authors.

You must be listening to a different corner of the
twittersphere/blogosphere than I am -- most everyone in my echo chamber
finds the current syntax to be incongruent and cumbersome.

What's more, if we're going to all the way with making these custom
properties, I think that document inheritance is only sometimes desired and
that there should be a way to define properties that do and do not inherit.
This is basically the same as real CSS properties, there are just some of
them that don't make sense to inherit and forcing it will just create
annoyance. This could be as simple as a naming convention but it could also
be done via a modifier e.g. !inherits;

Lastly, given that the stated explanation for why these variable are not
using a more variable like syntax, is that there's a desire to reserve that
syntax for macro-style variables in the future, I would excise the word var
from this spec.

Chris

On Tue, Aug 28, 2012 at 4:34 PM, Brian Kardell <bkardell@gmail.com> wrote:

>
> On Aug 28, 2012 4:51 PM, "Jens O. Meiert" <jens@meiert.com> wrote:
> >
> > > 2. Defining Custom Properties: the ‘var-*’ family of properties
> > >
> > > 3. Using Variables - the ‘var()’ notation
> >
> > What is the benefit in declaring and using variables—the same
> > variables—in such different ways? Are we not contracting a serious
> > “development usability” problem?
> >
> > Why does the variable name need to be part of the declaration?
> >
> > And what are, pardon me Tab, the other “‘variable-like’ things” we
> > would need the “$” syntax for if there is, so the community, such
> > immense immediate need for variables in CSS now, right at this moment?
> >
> > I argue that the syntax should be as simple and consistent as
> > possible, probably well borrowing from another language, and that if
> > there is no immediate need for something else that is “variable-like,”
> > it shouldn’t influence the spec in such a dramatic fashion.
> >
> > (While this probably sounds all more dramatic than I meant it to sound :)
> >
> > --
> > Jens O. Meiert
> > http://meiert.com/en/
> >
> It seems to me that the bulk of community feedback on twitter, all of the
> blogs dealing with this, etc. are now more or less in agreement with the
> general statements:
>
> We don't need to use $ for this
> They are actually better described as custom properties
> The left and right don't need to match forms (in fact, it seems there is
> agreement that in fact they probably shouldn't)
> Aside from the three characters "var" it is pretty good.
>
> Do you feel that is incorrect?  Can you point to somewhere I am not many
> seeing others who still are not on that page?  Do you have an alternate
> proposal which has not been considered or is it about $ on both sides as
> discussed earlier?
>
Received on Wednesday, 29 August 2012 01:30:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:59 GMT