Re: Proposal for adding variable declaration blocks

On Thu, Jul 3, 2008 at 12:31 PM, Christoph Päper
<christoph.paeper@crissov.de> wrote:
> Yes, except in legacy UAs. That's why this solution provides the best
> backwards compatibility of all proposals. People won't provide explicit
> fallbacks for today's browsers after variables will have been implemented in
> certain browsers.

I don't understand what you mean.  Are you suggesting that people
should call their background "white" instead of "myBackgroundColor"
(even if after a redesign, white=#FF0088) because "white" will
translate to a color and "myBackgroundColor" will be ignored in legacy
browsers?  If you are suggesting this, I really can't agree at all.
Any author who deliberately uses a color word to refer to a totally
different color, in any language, is using atrociously poor variable
naming.  That's like defining "const bool TRUE=false".  Moreover, if
authors use variables for all their colors and provide no explicit
fallback, then legacy browsers will just fall back to browser default
colors -- which is perhaps not ideal, but the page will be perfectly
legible, and it's the author's decision.

If you mean something else, I can't figure out what it is.

> It doesn't break anything. It may be strange to have e.g. a bluish colour
> called 'white' after a redesign, though.

It violates the principle of least surprise horribly.

>>> Also, it would make it impossible for someone new to the language to
>>> distinguish variables from keywords.
>
> This is actually an advantage of overwritable keywords. Automatic
> syntax-highlighting is also easier.

How is it an *advantage* that you can't distinguish keywords from
variables?  They're very different things, and are used very
differently.  If you think something's a keyword, you'll try to use it
in any stylesheet you edit.  If you think it's a variable, you'll only
use it in stylesheets where you know it's specifically defined.
Getting the two confused will lead to those new to CSS trying to use
variables as keywords, which will fail.

Every syntax highlighter I know of for any language assigns a
different color to variable names and language keywords (for exactly
this reason!), so I don't know why you think it will help syntax
highlighters any.

Received on Thursday, 3 July 2008 17:58:46 UTC