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

Re: Re : [css3-values] nesting calc()

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Wed, 20 Jun 2012 17:01:24 +0800
Message-ID: <4FE19164.1000605@csail.mit.edu>
To: François REMY <fremycompany_pub@yahoo.fr>
CC: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>
(12/06/20 16:46), François REMY wrote:
> -- HS: attr() is returning a string? Wow, what a misused potential. Never noticed it.
> My concern is that
>     animation: compute (15s - 3s);
> is a valid animation declaration right now (if we suppose the 'calc'
> to be implied). However, if we introduce a 'compute' function, it
> will be a breaking change in the language: the animation declaration
> will not work anymore, because it's going to be read as a call to the
> 'compute' function which may do something completely different than
> the initial purpose.

Oh, I see what you mean. But with the current CSS syntax, introducing
"compute()" wouldn't affect this example because you could not put a
space in between the identifier and the parentheses of a function call
(try "url ()" in general or "attr ()" in "content:" if you don't believe
me). This is a bit different from other major programming languages.

> This will probably lead to one ofthose  two possible consequences: 
> (a) we're going to restrict the scope of new functions to places that are not preceeded by an identifier.
> (b) we're going to modify the meaning of values when we introduce new functions. 

The real concern here is that if we introduce the bar parenthesis syntax
for "calc()", in css4-syntax+ we can't allow space to be put in between
the identifer and the parentheses of a function, like "content: attr
(name);", "background: url (example.png)" and whatnot. But given that
nobody really requested something like "url ()", I don't think we should
worry about this.

> Both of them are a concern for me. But maybe there's a trick I didn't notice that makes my concern invalid.
> ----- Mail original -----
> De : Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
> À : François REMY <fremycompany_pub@yahoo.fr>
> Cc : fantasai <fantasai.lists@inkedblade.net>; www-style@w3.org
> Envoyé le : Mercredi 20 juin 2012 9h58
> Objet : Re: [css3-values] nesting calc()
> (12/06/20 15:45), François REMY wrote:
>> I'm not an expert in CSS syntax but it seems to be a dangerous idea. Is
>> there a way in CSS to distinguish a function from an identifier followed
>> by parenthized expression? Example:
>>     animation: attr(anim);
>> and:
>>     animation: myAnim (15s - 3s);
>> ?
> Probably no, but I am not exactly sure what your concern is.
> Are you saying that people would be tempted to do
>   margin: auto(100% - 1em);
> and get wrong? If that's the case, why wouldn't people get wrong by thinking
>   margin: auto1em;
> would work? Is is the parenthesis notation that allures the authors to
> drop the whitespace in the middle?
> (In your example, "animation: attr(anim);" isn't valid because
> "attr(anim)" is a <string>.)
> Cheers,
> Kenny
Received on Wednesday, 20 June 2012 09:02:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:00 UTC