Re: Scientific notation in numbers

Zack Weinberg wrote:

 > I actively want to eliminate the mode switch; it adds extra branches to
 > a hot path in the lexer, and it is the only such wart in the lexical
 > rules.  To do so, scientific notation must either be accepted
 > everywhere that NUMBERs are accepted, or forbidden everywhere.  I don't
 > much care which, but I am opposed to howcome's compromise proposal of
 > allowing scientific notation only in property values where it is
 > "necessary".  That would *not* eliminate the mode switch, it would add
 > extra complexity to the parser (which would now have to toggle the
 > switch on particular properties, and might have to care about whether
 > SVG disagrees with CSS-proper about whether scientific notation is
 > necessary in some context), and it strikes me as a documentation
 > nightmare.

I'm all for removing complexity. And I get a headache from trying to
read style sheets like this:

   h1 { font-size: 2.6e-4em }

So, I'd like to avoid using scientific notation in CSS.

There seems to be tree arguments for allowing scientific notation:

 1) transformations need it

 2) it can be used as a browser switch

 3) it helps CSS-SVG harmonization

Regarding 1), it seems that a string-less API will be even better than
a scientific notation.

Regarding 2), the hacks we will see will look ugly. It will just add
another layer of complexity to coding CSS. 

Regarding 3), it seems the use of scientific notation in SVG is
limited to attributes and that we can harmonize without adding
scientific notation to all properties. 

 > I don't buy the assertion that scientific notation will enable
 > browser-sniffing.  NUMBERs can only appear in a property value
 > (per the appendix G grammar) so the most aggressive differentiation
 > between implementations that you can achieve with scientific notation
 > is to wipe out one property declaration.  How's that different from
 > feature-sniffing for novel property values, which we encourage?

Adding new property values opens up for browser sniffing, but it is
rarely a goal in itself -- it's more of an unwanted side effect of
adding useful functionality.

Cheers,

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Wednesday, 10 February 2010 22:12:22 UTC