Skip to content

"computationally idempotent" is a bad term #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbaron opened this issue Aug 23, 2016 · 6 comments
Closed

"computationally idempotent" is a bad term #282

dbaron opened this issue Aug 23, 2016 · 6 comments

Comments

@dbaron
Copy link
Member

dbaron commented Aug 23, 2016

The definition of registerProperty() partially defines the term "computationally idempotent".

This term doesn't make sense because computation of all values of all CSS properties is idempotent. Idempotence means that f(x) equals f(f(x)). In this case we're talking about f() being the function compute() that produces a computed value from a specified value. Pretending for a moment that both the input and output of this function is strings (rather than a data type that we can convert to strings): compute("1em") might well be "16px", but compute("16px") sure better be "16px". Likewise, compute("inherit") may well be "rgb(0, 0, 255)" (depending on the property and the inherited value, of course), but compute("rgb(0, 0, 255)") sure better be "rgb(0, 0, 255)". (Gecko has tests to test this for a very large set of properties and values that we add to whenever we add support for new CSS values.)

@shans
Copy link
Contributor

shans commented Aug 23, 2016

It is a terrible term but we couldn't think of anything better. Got any ideas?

@dbaron
Copy link
Member Author

dbaron commented Aug 23, 2016

computationally independent? (i.e., it's independent of the inherited values and values of other properties)

@shans
Copy link
Contributor

shans commented Aug 23, 2016

I think we want that x = f(x). In other words you can use "16px" because compute("16px") == "16px" but you can't use "1em" because compute("1em") != "1em". Basically we want the fixed points of the compute function.

I'm not sure that independent captures that completely, but it's better than idempotent.

@dbaron
Copy link
Member Author

dbaron commented Aug 23, 2016

That's a little too strict, since "12pt" is ok, because compute("12pt") is always "16px".

(I came up with independent because in Gecko we have a concept of recording dependencies.)

@shans
Copy link
Contributor

shans commented Aug 23, 2016

I think you can still count that as a fixed point with an appropriate form of equality. However, I think Chrome's initial values mechanism actually stores the values as computed, so we can't represent 12pt directly anyway.

@tabatkins
Copy link
Member

"independent" works for me - the clarified definition I'm using is much closer to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants