Re: Can we have more maths in calc()?

On Sunday 2014-04-06 21:36 -0400, Zack Weinberg wrote:
> If I can have _just two_ additional calc() features, min() plus being
> allowed to divide one <length> by another (the result being a
> dimensionless number) would mean not needing JavaScript in a scenario

For what it's worth, my previous post on why min() and max() are
hard(ish):
http://lists.w3.org/Archives/Public/www-style/2011Oct/0735.html

Adding division by lengths requires deciding how to handle division
by zero.  Currently calc() handles division by zero by rejecting
such values at parse time, but that's not possible with division by
lengths.  Like the min()/max() issue, it creates a bunch of new
error cases that we need to decide how to handle, though in this
case they're at least more clearly error cases that authors would
percieve as error cases.

Division by lengths (or times, etc.) also makes the rules for unit
analysis a bit harder, since it introduces the possibility of a
valid calc expression with multiple types of units (e.g., lengths,
times).  This isn't insurmountable, but requires a decent amount of
work.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Tuesday, 8 April 2014 01:22:30 UTC