Re: Proposal for adding variable declaration blocks

From: "Simetrical" <simetrical@gmail.com>
To: "Francois Remy" <fremycompany_pub@yahoo.fr>
>
> On Fri, Jul 18, 2008 at 4:14 PM, Francois Remy
> <fremycompany_pub@yahoo.fr> wrote:
>> I don't like $varName. I much prefer var(varName);
>
> I don't care, honestly.  var() is more CSS-style.  I just prefer
> $varName over =varName or =varName=.

Yes =varName is ugly, I agree with you.

>
>> If we choose for var(varName), it will be possible later to add some 
>> other
>> functions like :
>>
>>   var(oHeight + '5px')
>> or
>>   var(oWidth * 3)
>> or
>>   var('10%' - ('50px' * 2))
>> or
>>   color: var(iif(isDefined('tColor'), tColor, 'blue'))
>
> You mean like the already-existing calc() function?  calc(
> var(oHeight) + 5px ) or calc( $oHeight + 5px ) or whatnot should
> already work, in browsers that support calc() as well as variables,
> since variables are just another data type.  I assume that's the
> intent, anyway.

I was not aware of the disponibility of the calc function.

>
> The last one can just be
>
> color: blue;
> color: tColor;

Yes, in fact.
But it should be : << color: blue; color: var(tColor); >>
>
> since the second statement will be silently dropped if tColor is
> undefined.  Adding generic conditionals would probably make CSS
> Turing-complete, which I believe is something that's intentionally
> avoided to ensure simplicity and speed.  If you need complex
> conditionals that actually require things like iif(), that's what
> JavaScript is for.

It's not for nothing that I like ECMAScript :-)

>> PS : I'm not against $varName as shortcut of var(varName);
>
> Keeping one syntax for doing one thing should definitely be a goal
> here.  Pick one or the other, don't take the "add all the syntaxes
> people might like and let them pick" approach.
>

You're true, here. So, we should keep the var() syntax.

Note that some CSS functions provides some multiple syntax.
    border (thin > 2px; medium: 3px; thick > 5px)
    color: (red > #ff0000; ...)
    font-size: (2ex > 1em);
    ...

But this is not exactly the same as two syntax, its only contants.
Fremy 

Received on Friday, 18 July 2008 20:51:29 UTC