Re: [csswg-drafts] [css-values-5] What is meant by the distinction between "math function" vs. "function that evaluates to a <number>" (#11204)

Yes, "math function" refers to a specific class of functions, mostly defined in Values 4 currently.
* math functions form calculation trees together, allowing values like NaN to be passed between them without censoring
* the calculations in a math function always evaluate in the context of wherever the math function is placed, so for example a % resolves according to the property and carries "percentage-ness" in the return value even if it was computed away by the actual math, 'em' resolves according to the property/element, etc.

An implication of this is that a stack of nested math functions all *share* the same context for things like unit resolution or % meaning. But `media-progress()` doesn't do that - it changes its `<calc-sum>` arguments to have a different resolution context, that of MQs (`em` resolves against the initial value, %s don't have meaning, etc). So it can't be math function, or else when you nested it inside of *another* math function, you'd get a calculation tree with disparate semantics for some values.

Like, in `calc(2em + media-progress(width, 2em, 1000px))`, the two `2em` values mean totally different things.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11204#issuecomment-2474612685 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 13 November 2024 19:48:19 UTC